Runtime error running cythonize failed

Hi, I meet wit the following problem when I install from source: Cythonizing sources Processing numpy/random/mtrand/mtrand.pyx Traceback (most recent call last): File "/share/apps/bin/cython&q...

Hi,

I meet wit the following problem when I install from source:

Cythonizing sources
Processing numpy/random/mtrand/mtrand.pyx
Traceback (most recent call last):
  File "/share/apps/bin/cython", line 8, in <module>
    main(command_line = 1)
  File "/share/apps/lib/python2.7/site-packages/Cython/Compiler/Main.py", line 709, in main
    result = compile(sources, options)
  File "/share/apps/lib/python2.7/site-packages/Cython/Compiler/Main.py", line 684, in compile
    return compile_multiple(source, options)
  File "/share/apps/lib/python2.7/site-packages/Cython/Compiler/Main.py", line 657, in compile_multiple
    context = options.create_context()
  File "/share/apps/lib/python2.7/site-packages/Cython/Compiler/Main.py", line 582, in create_context
    self.cplus, self.language_level, options=self)
  File "/share/apps/lib/python2.7/site-packages/Cython/Compiler/Main.py", line 75, in __init__
    from . import Builtin, CythonScope
  File "/share/apps/lib/python2.7/site-packages/Cython/Compiler/CythonScope.py", line 5, in <module>
    from .UtilityCode import CythonUtilityCode
  File "/share/apps/lib/python2.7/site-packages/Cython/Compiler/UtilityCode.py", line 3, in <module>
    from .TreeFragment import parse_from_strings, StringParseContext
  File "/share/apps/lib/python2.7/site-packages/Cython/Compiler/TreeFragment.py", line 17, in <module>
    from .Visitor import VisitorTransform
  File "Cython/Compiler/Visitor.py", line 15, in init Cython.Compiler.Visitor (/share/apps/src/cython/Cython/Compiler/Visitor.c:19407)
  File "/share/apps/lib/python2.7/site-packages/Cython/Compiler/ExprNodes.py", line 4244, in <module>
    class SliceIndexNode(ExprNode):
  File "/share/apps/lib/python2.7/site-packages/Cython/Compiler/ExprNodes.py", line 4396, in SliceIndexNode
    "SliceObject", "ObjectHandling.c", context={'access': 'Get'})
  File "Cython/Compiler/Code.py", line 286, in Cython.Compiler.Code.UtilityCodeBase.load (/share/apps/src/cython/Cython/Compiler/Code.c:9181)
  File "Cython/Compiler/Code.py", line 525, in Cython.Compiler.Code.TempitaUtilityCode.__init__ (/share/apps/src/cython/Cython/Compiler/Code.c:15550)
  File "Cython/Compiler/Code.py", line 517, in Cython.Compiler.Code.sub_tempita (/share/apps/src/cython/Cython/Compiler/Code.c:15269)
  File "/share/apps/lib/python2.7/site-packages/Cython/Tempita/__init__.py", line 4, in <module>
    from ._tempita import *
  File "Cython/Tempita/_tempita.py", line 36, in init Cython.Tempita._tempita (/share/apps/src/cython/Cython/Tempita/_tempita.c:31807)
  File "/share/apps/lib/python2.7/cgi.py", line 50, in <module>
    import mimetools
  File "/share/apps/lib/python2.7/mimetools.py", line 6, in <module>
    import tempfile
  File "/share/apps/lib/python2.7/tempfile.py", line 35, in <module>
    from random import Random as _Random
  File "/share/apps/src/numpy-1.9.3/numpy/random/__init__.py", line 99, in <module>
    from .mtrand import *
ImportError: No module named mtrand
--fast-fail mtrand.c mtrand.pyx
Traceback (most recent call last):
  File "/share/apps/src/numpy-1.9.3/tools/cythonize.py", line 200, in <module>
    main()
  File "/share/apps/src/numpy-1.9.3/tools/cythonize.py", line 196, in main
    find_process_files(root_dir)
  File "/share/apps/src/numpy-1.9.3/tools/cythonize.py", line 188, in find_process_files
    process(cur_dir, fromfile, tofile, function, hash_db)
  File "/share/apps/src/numpy-1.9.3/tools/cythonize.py", line 162, in process
    processor_function(fromfile, tofile)
  File "/share/apps/src/numpy-1.9.3/tools/cythonize.py", line 73, in process_pyx
    raise Exception('Cython failed')
Exception: Cython failed
Traceback (most recent call last):
  File "setup.py", line 251, in <module>
    setup_package()
  File "setup.py", line 239, in setup_package
    generate_cython()
  File "setup.py", line 191, in generate_cython
    raise RuntimeError("Running cythonize failed!")
RuntimeError: Running cythonize failed!

I am using

Many thanks!

I have been using Websockify to allow the browser to connect to any application or service on a Linux machine. This involves setting up Websockify server that translates the WebSockets to the normal socket and enables the traffic to follow between the client and the server. Installation of Websockify is simple, but the process ended with an error “No module named Cython. RuntimeError: Running cythonize failed!“. And remember that the Websockify binary is not available for PPC64LE architecture (like most of the packages), so I ended up compiling it from the source.

Note:

I’m using the command python3.6, because Websockify requires Python version 3 and above. If your default Python version is greater than 3, then you just need to use python command instead of python3.6.

The installation is started using the below command.

#python3.6 setup.py install
[....]
run_build = parse_setuppy_commands()
Cythonizing sources
Processing numpy/random/_bounded_integers.pxd.in
Processing numpy/random/_mt19937.pyx
Traceback (most recent call last):
  File "/tmp/easy_install-n7o_lgt3/numpy-1.18.4/tools/cythonize.py", line 61, in process_pyx
    from Cython.Compiler.Version import version as cython_version
ModuleNotFoundError: No module named Cython
[...]
RuntimeError: Running cythonize failed!

How to fix No module named Cython

We need to install Cython package depending on the version of Python installed on the system as below:

#pip3.6 install Cython
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3.6 install --user` instead.
Collecting Cython
  Downloading https://files.pythonhosted.org/packages/9b/24/3416df8ae5962b09f6b522ad6d61e711dadb57816a6e4e76c3b99732f3c5/Cython-0.29.17-py2.py3-none-any.whl (971kB)
    100% |████████████████████████████████| 972kB 961kB/s
Installing collected packages: Cython
Successfully installed Cython-0.29.17

That’s it. As the Cython package is installed,  I went on to install Websockify successfully.

Author Profile

Ramya Santhosh

is a Web Designer and content creator. A freelance writer on latest trends in technology, gadget reviews, How to’s and many more.

Содержание

  1. Как установить пакет dlib в PyCharm если pip не работает?
  2. Как правильно устанавливать библиотеки в PyCharm?
  3. VolodinAS
  4. Русские Блоги
  5. Импорт Pygame библиотеки в PyCharm не удалось, и решение
  6. ERROR: Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host=’files.pythonhosted.org’, port=443): Max retries exceeded with url:…

Как установить пакет dlib в PyCharm если pip не работает?

Collecting dlib
Using cached dlib-19.21.1.tar.gz (3.6 MB)
Using legacy ‘setup.py install’ for dlib, since package ‘wheel’ is not installed.
Installing collected packages: dlib
Running setup.py install for dlib: started
Running setup.py install for dlib: finished with status ‘error’

ERROR: Command errored out with exit status 1:
command: ‘C:Program FilesPython38python.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘»‘»‘C:\Users\Vladimir\AppData\Local\Temp\pip-install-wo1po3h2\dlib\setup.py’»‘»‘; __file__=’»‘»‘C:\Users\Vladimir\AppData\Local\Temp\pip-install-wo1po3h2\dlib\setup.py’»‘»‘;f=getattr(tokenize, ‘»‘»‘open’»‘»‘, open)(__file__);code=f.read().replace(‘»‘»‘rn’»‘»‘, ‘»‘»‘n’»‘»‘);f.close();exec(compile(code, __file__, ‘»‘»‘exec’»‘»‘))’ install —record ‘C:UsersVladimirAppDataLocalTemppip-record-pigi9lcbinstall-record.txt’ —single-version-externally-managed —user —prefix= —compile —install-headers ‘C:UsersVladimirAppDataRoamingPythonPython38Includedlib’
cwd: C:UsersVladimirAppDataLocalTemppip-install-wo1po3h2dlib
Complete output (62 lines):
running install
running build
running build_py
package init file ‘toolspythondlib__init__.py’ not found (or not a regular file)
warning: build_py: byte-compiling is disabled, skipping.

running build_ext
Building extension for Python 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:52:53) [MSC v.1927 64 bit (AMD64)]
Invoking CMake setup: ‘cmake C:UsersVladimirAppDataLocalTemppip-install-wo1po3h2dlibtoolspython -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:UsersVladimirAppDataLocalTemppip-install-wo1po3h2dlibbuildlib.win-amd64-3.8 -DPYTHON_EXECUTABLE=C:Program FilesPython38python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:UsersVladimirAppDataLocalTemppip-install-wo1po3h2dlibbuildlib.win-amd64-3.8 -A x64’
— Building for: NMake Makefiles
CMake Error at CMakeLists.txt:5 (message):

You must use Visual Studio to build a python extension on windows. If you
are getting this error it means you have not installed Visual C++. Note
that there are many flavors of Visual Studio, like Visual Studio for C#
development. You need to install Visual Studio for C++.

— Configuring incomplete, errors occurred!
Traceback (most recent call last):
File «», line 1, in
File «C:UsersVladimirAppDataLocalTemppip-install-wo1po3h2dlibsetup.py», line 223, in
setup(
File «C:Program FilesPython38libsite-packagessetuptools__init__.py», line 165, in setup
return distutils.core.setup(**attrs)
File «C:Program FilesPython38libdistutilscore.py», line 148, in setup
dist.run_commands()
File «C:Program FilesPython38libdistutilsdist.py», line 966, in run_commands
self.run_command(cmd)
File «C:Program FilesPython38libdistutilsdist.py», line 985, in run_command
cmd_obj.run()
File «C:Program FilesPython38libsite-packagessetuptoolscommandinstall.py», line 61, in run
return orig.install.run(self)
File «C:Program FilesPython38libdistutilscommandinstall.py», line 545, in run
self.run_command(‘build’)
File «C:Program FilesPython38libdistutilscmd.py», line 313, in run_command
self.distribution.run_command(command)
File «C:Program FilesPython38libdistutilsdist.py», line 985, in run_command
cmd_obj.run()
File «C:Program FilesPython38libdistutilscommandbuild.py», line 135, in run
self.run_command(cmd_name)
File «C:Program FilesPython38libdistutilscmd.py», line 313, in run_command
self.distribution.run_command(command)
File «C:Program FilesPython38libdistutilsdist.py», line 985, in run_command
cmd_obj.run()
File «C:UsersVladimirAppDataLocalTemppip-install-wo1po3h2dlibsetup.py», line 135, in run
self.build_extension(ext)
File «C:UsersVladimirAppDataLocalTemppip-install-wo1po3h2dlibsetup.py», line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File «C:Program FilesPython38libsubprocess.py», line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘cmake’, ‘C:\Users\Vladimir\AppData\Local\Temp\pip-install-wo1po3h2\dlib\tools\python’, ‘-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Vladimir\AppData\Local\Temp\pip-install-wo1po3h2\dlib\build\lib.win-amd64-3.8’, ‘-DPYTHON_EXECUTABLE=C:\Program Files\Python38\python.exe’, ‘-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Vladimir\AppData\Local\Temp\pip-install-wo1po3h2\dlib\build\lib.win-amd64-3.8’, ‘-A’, ‘x64′]’ returned non-zero exit status 1.
—————————————-
ERROR: Command errored out with exit status 1: ‘C:Program FilesPython38python.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘»‘»‘C:\Users\Vladimir\AppData\Local\Temp\pip-install-wo1po3h2\dlib\setup.py’»‘»‘; __file__=’»‘»‘C:\Users\Vladimir\AppData\Local\Temp\pip-install-wo1po3h2\dlib\setup.py’»‘»‘;f=getattr(tokenize, ‘»‘»‘open’»‘»‘, open)(__file__);code=f.read().replace(‘»‘»‘rn’»‘»‘, ‘»‘»‘n’»‘»‘);f.close();exec(compile(code, __file__, ‘»‘»‘exec’»‘»‘))’ install —record ‘C:UsersVladimirAppDataLocalTemppip-record-pigi9lcbinstall-record.txt’ —single-version-externally-managed —user —prefix= —compile —install-headers ‘C:UsersVladimirAppDataRoamingPythonPython38Includedlib’ Check the logs for full command output.
WARNING: You are using pip version 20.2.1; however, version 20.3.3 is available.
You should consider upgrading via the ‘C:Program FilesPython38python.exe -m pip install —upgrade pip’ command.

К слову, MS VC я поставил почти все версии, но ему просто плевать.

Спасите меня пожалуйста, уже голова плывет.

Источник

Как правильно устанавливать библиотеки в PyCharm?

VolodinAS

Новичок

Здравствуйте, уважаемые форумчане. Я — новичок в python, не ругайтесь, пожалуйста.

Предварительные данные:

  1. Указать свою операционную систему — WINDOWS 10
  2. Указать версию Python — PYTHON 3.8.0
  3. Укажите версию библиотек с которыми работаете, вставьте в спойлер вывод команды pip list

  • Описание вопроса ниже
  • Суть вопроса такова.

    Через командную строку я установил нужные мне библиотеки.
    Команды:

    То есть, через IDLE всё работает.

    Запускаю PyCharm, вставляю этот же код:

    1AppDataLocalTemptmpttixcb_z:
    Error in sitecustomize; set PYTHONVERBOSE for traceback:
    SyntaxError: (unicode error) ‘utf-8’ codec can’t decode byte 0xef in position 0: invalid continuation byte (sitecustomize.py, line 7)
    Running from numpy source directory.
    setup.py:480: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
    run_build = parse_setuppy_commands()
    Cythonizing sources
    Error in sitecustomize; set PYTHONVERBOSE for traceback:
    SyntaxError: (unicode error) ‘utf-8’ codec can’t decode byte 0xef in position 0: invalid continuation byte (sitecustomize.py, line 7)
    Processing numpy/random_bounded_integers.pxd.in
    Processing numpy/randombit_generator.pyx
    Traceback (most recent call last):
    File «C:UsersVolodinASAppDataLocalTemppycharm-packagingnumpytoolscythonize.py», line 59, in process_pyx
    from Cython.Compiler.Version import version as cython_version
    ModuleNotFoundError: No module named ‘Cython’

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File «C:UsersVolodinASAppDataLocalTemppycharm-packagingnumpytoolscythonize.py», line 235, in
    main()
    File «C:UsersVolodinASAppDataLocalTemppycharm-packagingnumpytoolscythonize.py», line 231, in main
    find_process_files(root_dir)
    File «C:UsersVolodinASAppDataLocalTemppycharm-packagingnumpytoolscythonize.py», line 222, in find_process_files
    process(root_dir, fromfile, tofile, function, hash_db)
    File «C:UsersVolodinASAppDataLocalTemppycharm-packagingnumpytoolscythonize.py», line 188, in process
    processor_function(fromfile, tofile)
    File «C:UsersVolodinASAppDataLocalTemppycharm-packagingnumpytoolscythonize.py», line 64, in process_pyx
    raise OSError(‘Cython needs to be installed in Python as a module’)
    OSError: Cython needs to be installed in Python as a module
    Traceback (most recent call last):
    File «D:DOCUMENTSПРОГРАММИРОВАНИЕPYTHONPROJECTSPYCHARMme2safeautocrackervenvlibsite-packagespip-19.0.3-py3.8.eggpip_vendorpep517_in_process.py», line 207, in
    main()
    File «D:DOCUMENTSПРОГРАММИРОВАНИЕPYTHONPROJECTSPYCHARMme2safeautocrackervenvlibsite-packagespip-19.0.3-py3.8.eggpip_vendorpep517_in_process.py», line 197, in main
    json_out[‘return_val’] = hook(**hook_input[‘kwargs’])
    File «D:DOCUMENTSПРОГРАММИРОВАНИЕPYTHONPROJECTSPYCHARMme2safeautocrackervenvlibsite-packagespip-19.0.3-py3.8.eggpip_vendorpep517_in_process.py», line 69, in prepare_metadata_for_build_wheel
    return hook(metadata_directory, config_settings)
    File «D:DOCUMENTSПРОГРАММИРОВАНИЕPYTHONPROJECTSPYCHARMme2safeautocrackervenvlibsite-packagessetuptools-40.8.0-py3.8.eggsetuptoolsbuild_meta.py», line 140, in prepare_metadata_for_build_wheel
    File «D:DOCUMENTSПРОГРАММИРОВАНИЕPYTHONPROJECTSPYCHARMme2safeautocrackervenvlibsite-packagessetuptools-40.8.0-py3.8.eggsetuptoolsbuild_meta.py», line 210, in run_setup
    File «D:DOCUMENTSПРОГРАММИРОВАНИЕPYTHONPROJECTSPYCHARMme2safeautocrackervenvlibsite-packagessetuptools-40.8.0-py3.8.eggsetuptoolsbuild_meta.py», line 126, in run_setup
    File «setup.py», line 508, in
    setup_package()
    File «setup.py», line 488, in setup_package
    generate_cython()
    File «setup.py», line 285, in generate_cython
    raise RuntimeError(«Running cythonize failed!»)
    RuntimeError: Running cythonize failed!

    Command «D:DOCUMENTSПРОГРАММИРОВАНИЕPYTHONPROJECTSPYCHARMme2safeautocrackervenvScriptspython.exe D:DOCUMENTSПРОГРАММИРОВАНИЕPYTHONPROJECTSPYCHARMme2safeautocrackervenvlibsite-packagespip-19.0.3-py3.8.eggpip_vendorpep517_in_process.py prepare_metadata_for_build_wheel C:UsersVOLODI

    1AppDataLocalTemptmpttixcb_z» failed with error code 1 in C:UsersVolodinASAppDataLocalTemppycharm-packagingnumpy

    Помогите, пожалуйста, решить проблему. Пытался гуглить, но так и не нашел нужного решения. Не понимаю, PyCharm не использует ранее установленные библиотеки?

    Источник

    Русские Блоги

    Импорт Pygame библиотеки в PyCharm не удалось, и решение

    ERROR: Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host=’files.pythonhosted.org’, port=443): Max retries exceeded with url:…

    • Спрос: Используйте PyCharm к программе в Win10, где требуется сторонняя библиотека Pygame.
    • Предварительное решение: Установка сторонних библиотек с программным обеспечением PyCharm.
    • шаг:
    1. Нажмите на PyCharm Программное обеспечение в строке меню: Файл -> Настройки

    1. Нажмите, в свою очередь: Проект: Plane_Battle -> Project Переводчик -> Список плагинов+«Открыть библиотеку программного обеспечения страницу поиска сторонних производителей.

    Потому что мой проект называется Plane_Battle, список слева меню показывает Project Plane_Battle. Вы можете быть-> Проект: Ваше имя проекта

    Введите «Pygame» Enter «Pygame» в окне поиска, искать сторонние библиотеки

    • Следующие советы могут появиться в случае неудобной скорости сети:

    Не паникуйте, просто еще несколько раз!

    Программное обеспечение находит позже, нажмите кнопку установки кнопки в левом нижнем углу, ожидая, чтобы установить .

    Но, к сожалению, установка имеет ошибку!

    Нажмите на оперативное сообщение об ошибке, чтобы получить следующее сообщение:

    • Загрузите исходную сеть слишком медленно, то соединение не подключен к серверу;
    • Версия PIP является слишком низкой и должна быть повышена.

    Изменить загруженный адрес источника:

    Нажмите на нижний левый угол управления, а затем всплывают на следующей странице, нажмите справа плюс, добавить новый источник:

    После выбора нового источника, нажмите кнопку OK, чтобы обновить, а затем нажмите кнопку Установить Установить пакет.

    К несчастью! Еще об ошибке! Действительно Действительно

    Обновление версии PIP:

    В соответствии с модулем импорта, ошибка проворная информацию можно увидеть, мой PyCharm путь D:liangplanes_battlevenvScripts

    Следовательно, терминал для Windows входит в путь выше и обновляет PIP в рамках этого пути.

    Шаги: «WIN кнопка + г» -> CMD -> d: -> d: лян planes_battle venv Scripts -> python.exe -m pip install —upgrade pip -i http://pypi.douban.com/simple —trusted-host pypi.douban.com

    После завершения обновления, вернитесь к шагу 4, найти Pygame после выбора, нажмите кнопку Установить в нижнем левом углу, чтобы установить пакет, продолжить установку .

    К сожалению, может быть, вы можете также установить неудачными! Действительно Действительно

    • Окончательный большой трюкТак как он не может быть установлен с помощью программного обеспечения, то сообщения об ошибке, мы можем также попытаться установить в терминальной среде:

    Точно так же, как и обновление метод PIP, сначала введите путь окружения проекта PyCharm и введите команду следующую строку:

    Источник Douban используется, конечно, вы можете также изменить его на официальный источник Али или Ubuntu

    Таким образом, библиотека Pygame успешно. D:liangplanes_battlevenvScripts Он устанавливается в среде Конечно, необходимо помнить, что проект выбирает только интерпретатор для ссылки на библиотеку Pygame.:

    Источник

    Skip to content



    Open


    Issue created Dec 16, 2019 by Cyb3r Jak3@Cyb3r-Jak3

    GitLab CI Dependency Scanning fails with numpy

    Summary

    When using Dependency Scanning template with python and the package numpy, it will exit with error code 1 due to ModuleNotFoundError: No module named 'Cython.

    Steps to reproduce

    Have numpy used in a python program.

    Example Project

    Example here

    What is the current bug behavior?

    When collecting numpy, which is a requirement of pandas, it will try and use cython which is not available.

    What is the expected correct behavior?

    It will not exit with code 1.

    Relevant logs and/or screenshots

    From build log

    Collecting pandas
      Downloading https://files.pythonhosted.org/packages/b7/93/b544dd08092b457d88e10fc1e0989d9397fd32ca936fdfcbb2584178dd2b/pandas-0.25.3.tar.gz (12.6MB)
      Saved ./dist/pandas-0.25.3.tar.gz
        ERROR: Command errored out with exit status 1:
         command: /usr/local/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-download-bvjxd7wr/pandas/setup.py'"'"'; __file__='"'"'/tmp/pip-download-bvjxd7wr/pandas/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-download-bvjxd7wr/pandas/pip-egg-info
             cwd: /tmp/pip-download-bvjxd7wr/pandas/
        Complete output (101 lines):
        Processing numpy/random/_bounded_integers.pxd.in
        Processing numpy/random/_common.pyx
        Traceback (most recent call last):
          File "/tmp/easy_install-x482g_kz/numpy-1.18.0rc1/tools/cythonize.py", line 61, in process_pyx
            from Cython.Compiler.Version import version as cython_version
        ModuleNotFoundError: No module named 'Cython'
        
        During handling of the above exception, another exception occurred:
        
        Traceback (most recent call last):
          File "/tmp/easy_install-x482g_kz/numpy-1.18.0rc1/tools/cythonize.py", line 238, in <module>
            main()
          File "/tmp/easy_install-x482g_kz/numpy-1.18.0rc1/tools/cythonize.py", line 234, in main
            find_process_files(root_dir)
          File "/tmp/easy_install-x482g_kz/numpy-1.18.0rc1/tools/cythonize.py", line 225, in find_process_files
            process(root_dir, fromfile, tofile, function, hash_db)
          File "/tmp/easy_install-x482g_kz/numpy-1.18.0rc1/tools/cythonize.py", line 191, in process
            processor_function(fromfile, tofile)
          File "/tmp/easy_install-x482g_kz/numpy-1.18.0rc1/tools/cythonize.py", line 66, in process_pyx
            raise OSError('Cython needs to be installed in Python as a module')
        OSError: Cython needs to be installed in Python as a module
        Cythonizing sources
        Running from numpy source directory.
        /tmp/easy_install-x482g_kz/numpy-1.18.0rc1/setup.py:425: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
          run_build = parse_setuppy_commands()
        Traceback (most recent call last):
          File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 154, in save_modules
            yield saved
          File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 195, in setup_context
            yield
          File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 250, in run_setup
            _execfile(setup_script, ns)
          File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 45, in _execfile
            exec(code, globals, locals)
          File "/tmp/easy_install-x482g_kz/numpy-1.18.0rc1/setup.py", line 450, in <module>
        
          File "/tmp/easy_install-x482g_kz/numpy-1.18.0rc1/setup.py", line 433, in setup_package
            def finalize_options(self):
          File "/tmp/easy_install-x482g_kz/numpy-1.18.0rc1/setup.py", line 240, in generate_cython
            """Custom distutils command to clean the .so and .pyc files."""
        RuntimeError: Running cythonize failed!
        
        During handling of the above exception, another exception occurred:
        
        Traceback (most recent call last):
          File "<string>", line 1, in <module>
          File "/tmp/pip-download-bvjxd7wr/pandas/setup.py", line 840, in <module>
            **setuptools_kwargs
          File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 144, in setup
            _install_setup_requires(attrs)
          File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 139, in _install_setup_requires
            dist.fetch_build_eggs(dist.setup_requires)
          File "/usr/local/lib/python3.6/site-packages/setuptools/dist.py", line 720, in fetch_build_eggs
            replace_conflicting=True,
          File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 782, in resolve
            replace_conflicting=replace_conflicting
          File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1065, in best_match
            return self.obtain(req, installer)
          File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1077, in obtain
            return installer(requirement)
          File "/usr/local/lib/python3.6/site-packages/setuptools/dist.py", line 787, in fetch_build_egg
            return cmd.easy_install(req)
          File "/usr/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 679, in easy_install
            return self.install_item(spec, dist.location, tmpdir, deps)
          File "/usr/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 705, in install_item
            dists = self.install_eggs(spec, download, tmpdir)
          File "/usr/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 890, in install_eggs
            return self.build_and_install(setup_script, setup_base)
          File "/usr/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 1158, in build_and_install
            self.run_setup(setup_script, setup_base, args)
          File "/usr/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 1144, in run_setup
            run_setup(setup_script, args)
          File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 253, in run_setup
            raise
          File "/usr/local/lib/python3.6/contextlib.py", line 99, in __exit__
            self.gen.throw(type, value, traceback)
          File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 195, in setup_context
            yield
          File "/usr/local/lib/python3.6/contextlib.py", line 99, in __exit__
            self.gen.throw(type, value, traceback)
          File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 166, in save_modules
            saved_exc.resume()
          File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 141, in resume
            six.reraise(type, exc, self._tb)
          File "/usr/local/lib/python3.6/site-packages/setuptools/_vendor/six.py", line 685, in reraise
            raise value.with_traceback(tb)
          File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 154, in save_modules
            yield saved
          File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 195, in setup_context
            yield
          File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 250, in run_setup
            _execfile(setup_script, ns)
          File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 45, in _execfile
            exec(code, globals, locals)
          File "/tmp/easy_install-x482g_kz/numpy-1.18.0rc1/setup.py", line 450, in <module>
        
          File "/tmp/easy_install-x482g_kz/numpy-1.18.0rc1/setup.py", line 433, in setup_package
            def finalize_options(self):
          File "/tmp/easy_install-x482g_kz/numpy-1.18.0rc1/setup.py", line 240, in generate_cython
            """Custom distutils command to clean the .so and .pyc files."""
        RuntimeError: Running cythonize failed!
        ----------------------------------------
    ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
    exit status 1

    Output of checks

    This bug happens on GitLab.com

    Edited Jan 08, 2020 by Fabien Catteau

    martinmin

    Posts: 11
    Joined: 2021/05/20 06:19:06

    Can’t find cython even though it’s installed

    I am on Centos 7 and created an conda python=3.8 environment:

    Code: Select all

    conda create -n py385 python=3.8.5

    Code: Select all

    $ which python
    ~/miniconda3/envs/py385/bin/python
    (py385) [congmin@localhost spbo]$ python
    Python 3.8.5 (default, Sep  4 2020, 07:30:14) 
    [GCC 7.3.0] :: Anaconda, Inc. on linux
    Type "help", "copyright", "credits" or "license" for more information.

    I also installed cython in the same environment and checked:

    Code: Select all

    python -c "from Cython.Compiler.Version import version; print(version)" 
    0.29.21 . 

    It’s all right with 3.8.5 installed. However, when I compile a cython package it failed and it shows that it is using Python 3.7 to compile, instead of python 3.8. What caused this?

    Code: Select all

    sudo python setup.py build_ext --inplace
    Cythonizing sources
    Processing token.pyx
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/local/lib/python3.7/site-packages/Cython/Compiler/Main.py", line 840, in setuptools_main
        return main(command_line = 1)
      File "/usr/local/lib/python3.7/site-packages/Cython/Compiler/Main.py", line 858, in main
        result = compile(sources, options)
      File "/usr/local/lib/python3.7/site-packages/Cython/Compiler/Main.py", line 780, in compile
        return compile_multiple(source, options)
      File "/usr/local/lib/python3.7/site-packages/Cython/Compiler/Main.py", line 750, in compile_multiple
        context = options.create_context()
      File "/usr/local/lib/python3.7/site-packages/Cython/Compiler/Main.py", line 597, in create_context
        self.cplus, self.language_level, options=self)
      File "/usr/local/lib/python3.7/site-packages/Cython/Compiler/Main.py", line 80, in __init__
        from . import Builtin, CythonScope
      File "/usr/local/lib/python3.7/site-packages/Cython/Compiler/CythonScope.py", line 5, in <module>
        from .UtilityCode import CythonUtilityCode
      File "/usr/local/lib/python3.7/site-packages/Cython/Compiler/UtilityCode.py", line 3, in <module>
        from .TreeFragment import parse_from_strings, StringParseContext
      File "/usr/local/lib/python3.7/site-packages/Cython/Compiler/TreeFragment.py", line 17, in <module>
        from .Visitor import VisitorTransform
      File "Cython/Compiler/Visitor.py", line 12, in init Cython.Compiler.Visitor
      File "/usr/local/lib/python3.7/inspect.py", line 40, in <module>
        import linecache
      File "/usr/local/lib/python3.7/linecache.py", line 11, in <module>
        import tokenize
      File "/usr/local/lib/python3.7/tokenize.py", line 35, in <module>
        from token import *
      File "token.pyx", line 1, in init spacy.tokens.token
        # cython: infer_types=True
      File "/usr/local/lib/python3.7/site-packages/numpy/__init__.py", line 152, in <module>
        from . import random
      File "/usr/local/lib/python3.7/site-packages/numpy/random/__init__.py", line 181, in <module>
        from . import _pickle
      File "/usr/local/lib/python3.7/site-packages/numpy/random/_pickle.py", line 1, in <module>
        from .mtrand import RandomState
      File "_bit_generator.pxd", line 14, in init numpy.random.mtrand
      File "_bit_generator.pyx", line 255, in init numpy.random._bit_generator
    AttributeError: type object 'numpy.random._bit_generator.SeedSequence' has no attribute '__reduce_cython__'
    Traceback (most recent call last):
      File "/data0/spbo/bin/cythonize.py", line 60, in process_pyx
        ["cython"] + flags + ["-o", tofile, fromfile], env=os.environ
      File "/usr/local/lib/python3.7/subprocess.py", line 323, in call
        with Popen(*popenargs, **kwargs) as p:
      File "/usr/local/lib/python3.7/subprocess.py", line 775, in __init__
        restore_signals, start_new_session)
      File "/usr/local/lib/python3.7/subprocess.py", line 1522, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: 'cython': 'cython'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/data0/spbo/bin/cythonize.py", line 169, in <module>
        run(args.root)
      File "/data0/spbo/bin/cythonize.py", line 158, in run
        process(base, filename, db)
      File "/data0/spbo/bin/cythonize.py", line 124, in process
        preserve_cwd(base, process_pyx, root + ".pyx", root + ".cpp")
      File "/data0/spbo/bin/cythonize.py", line 87, in preserve_cwd
        func(*args)
      File "/data0/spbo/bin/cythonize.py", line 78, in process_pyx
        raise Exception("Cython failed")
    Exception: Cython failed
    Traceback (most recent call last):
      File "setup.py", line 199, in <module>
        setup_package()
      File "setup.py", line 187, in setup_package
        generate_cython(root, "spacy")
      File "setup.py", line 114, in generate_cython
        raise RuntimeError("Running cythonize failed")
    RuntimeError: Running cythonize failed


    martinmin

    Posts: 11
    Joined: 2021/05/20 06:19:06

    Re: Can’t find cython even though it’s installed

    Post

    by martinmin » 2021/06/09 20:22:23

    What’s strange is that, it is using python 3.7, not the python 3.8 which my environment has installed.


    User avatar

    TrevorH

    Site Admin
    Posts: 32529
    Joined: 2009/09/24 10:40:56
    Location: Brighton, UK

    Re: Can’t find cython even though it’s installed

    Post

    by TrevorH » 2021/06/09 21:02:35

    sudo strips lots of environment variables and substitutes others.


    martinmin

    Posts: 11
    Joined: 2021/05/20 06:19:06

    Re: Can’t find cython even though it’s installed

    Post

    by martinmin » 2021/06/09 22:43:00

    I didn’t get. What do you mean? Please be a bit more specific and thank you.


    User avatar

    TrevorH

    Site Admin
    Posts: 32529
    Joined: 2009/09/24 10:40:56
    Location: Brighton, UK

    Re: Can’t find cython even though it’s installed

    Post

    by TrevorH » 2021/06/09 22:49:10

    Lots of things that you had set as the user you used will not have been passed through via sudo to run `sudo python setup.py build_ext —inplace` — specifically $PATH for a start. So when it went to run ‘python’ as root (via sudo) it wil lhave searched a different PATH and found a different python executable…


    martinmin

    Posts: 11
    Joined: 2021/05/20 06:19:06

    Re: Can’t find cython even though it’s installed

    Post

    by martinmin » 2021/06/10 00:40:54

    So how to solve this issue when using Anaconda? Our typical environment is to run using sudo to install.


    martinmin

    Posts: 11
    Joined: 2021/05/20 06:19:06

    Re: Can’t find cython even though it’s installed

    Post

    by martinmin » 2021/06/10 21:03:22

    Even just using Python 3.7, it still complains the absence of cython, as below. There is no Python 3.8 involved. Also, cython is already installed for python 3.7.

    Code: Select all

    sudo python setup.py build_ext --inplace
    Cythonizing sources
    Processing token.pyx
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/local/lib/python3.7/site-packages/Cython/Compiler/Main.py", line 840, in setuptools_main
        return main(command_line = 1)
      File "/usr/local/lib/python3.7/site-packages/Cython/Compiler/Main.py", line 858, in main
        result = compile(sources, options)
      File "/usr/local/lib/python3.7/site-packages/Cython/Compiler/Main.py", line 780, in compile
        return compile_multiple(source, options)
      File "/usr/local/lib/python3.7/site-packages/Cython/Compiler/Main.py", line 750, in compile_multiple
        context = options.create_context()
      File "/usr/local/lib/python3.7/site-packages/Cython/Compiler/Main.py", line 597, in create_context
        self.cplus, self.language_level, options=self)
      File "/usr/local/lib/python3.7/site-packages/Cython/Compiler/Main.py", line 80, in __init__
        from . import Builtin, CythonScope
      File "/usr/local/lib/python3.7/site-packages/Cython/Compiler/CythonScope.py", line 5, in <module>
        from .UtilityCode import CythonUtilityCode
      File "/usr/local/lib/python3.7/site-packages/Cython/Compiler/UtilityCode.py", line 3, in <module>
        from .TreeFragment import parse_from_strings, StringParseContext
      File "/usr/local/lib/python3.7/site-packages/Cython/Compiler/TreeFragment.py", line 17, in <module>
        from .Visitor import VisitorTransform
      File "Cython/Compiler/Visitor.py", line 12, in init Cython.Compiler.Visitor
      File "/usr/local/lib/python3.7/inspect.py", line 40, in <module>
        import linecache
      File "/usr/local/lib/python3.7/linecache.py", line 11, in <module>
        import tokenize
      File "/usr/local/lib/python3.7/tokenize.py", line 35, in <module>
        from token import *
      File "token.pyx", line 1, in init spacy.tokens.token
        # cython: infer_types=True
      File "/usr/local/lib/python3.7/site-packages/numpy/__init__.py", line 152, in <module>
        from . import random
      File "/usr/local/lib/python3.7/site-packages/numpy/random/__init__.py", line 181, in <module>
        from . import _pickle
      File "/usr/local/lib/python3.7/site-packages/numpy/random/_pickle.py", line 1, in <module>
        from .mtrand import RandomState
      File "_bit_generator.pxd", line 14, in init numpy.random.mtrand
      File "_bit_generator.pyx", line 255, in init numpy.random._bit_generator
    AttributeError: type object 'numpy.random._bit_generator.SeedSequence' has no attribute '__reduce_cython__'
    Traceback (most recent call last):
      File "/data0/congmin/wb-nlp-tool/spaCy-weibo/bin/cythonize.py", line 60, in process_pyx
        ["cython"] + flags + ["-o", tofile, fromfile], env=os.environ
      File "/usr/local/lib/python3.7/subprocess.py", line 323, in call
        with Popen(*popenargs, **kwargs) as p:
      File "/usr/local/lib/python3.7/subprocess.py", line 775, in __init__
        restore_signals, start_new_session)
      File "/usr/local/lib/python3.7/subprocess.py", line 1522, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: 'cython': 'cython'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/data0/congmin/wb-nlp-tool/spaCy-weibo/bin/cythonize.py", line 169, in <module>
        run(args.root)
      File "/data0/congmin/wb-nlp-tool/spaCy-weibo/bin/cythonize.py", line 158, in run
        process(base, filename, db)
      File "/data0/congmin/wb-nlp-tool/spaCy-weibo/bin/cythonize.py", line 124, in process
        preserve_cwd(base, process_pyx, root + ".pyx", root + ".cpp")
      File "/data0/congmin/wb-nlp-tool/spaCy-weibo/bin/cythonize.py", line 87, in preserve_cwd
        func(*args)
      File "/data0/congmin/wb-nlp-tool/spaCy-weibo/bin/cythonize.py", line 78, in process_pyx
        raise Exception("Cython failed")
    Exception: Cython failed
    Traceback (most recent call last):
      File "setup.py", line 199, in <module>
        setup_package()
      File "setup.py", line 187, in setup_package
        generate_cython(root, "spacy")
      File "setup.py", line 114, in generate_cython
        raise RuntimeError("Running cythonize failed")
    RuntimeError: Running cythonize failed


    User avatar

    jlehtone

    Posts: 4251
    Joined: 2007/12/11 08:17:33
    Location: Finland

    Re: Can’t find cython even though it’s installed

    Post

    by jlehtone » 2021/06/10 21:40:00

    martinmin wrote: ↑

    2021/06/10 00:40:54


    So how to solve this issue when using Anaconda? Our typical environment is to run using sudo to install.

    Our typical environment is to install without sudo. Well, properly RPM-packaged packets are installed with elevated rights, but all «source», «binary blob», «pip/setup», «R packages», etc are installed as regular user to directories, where regular user can write to. Definitely not to system directories.

    I have not yet decided whether I loathe or just strongly dislike ‘conda’. Doesn’t conda effectively create python virtual env? Why would you need sudo with it?


    martinmin

    Posts: 11
    Joined: 2021/05/20 06:19:06

    Re: Can’t find cython even though it’s installed

    Post

    by martinmin » 2021/06/11 01:57:31

    I need ‘sudo’ because our machines are configured by op people this way. If you need write permission, you need to use sudo.


    User avatar

    jlehtone

    Posts: 4251
    Joined: 2007/12/11 08:17:33
    Location: Finland

    Re: Can’t find cython even though it’s installed

    Post

    by jlehtone » 2021/06/12 17:38:56

    martinmin wrote: ↑

    2021/06/11 01:57:31


    I need ‘sudo’ because our machines are configured by op people this way. If you need write permission, you need to use sudo.

    Technically, couldn’t you merely use sudo to create directory that has permissions for your accout and then run install without sudo?


    Понравилась статья? Поделить с друзьями:
  • Runtime error cuda out of memory
  • Runtime error roblox
  • Runtime error risen
  • Runtime error release unlocked lock
  • Runtime error regsvr32 r6034