Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

ModuleNotFoundError: No module named 'Cython' when installing with pip version 23.1 #107

Closed
cosminc98 opened this issue Apr 21, 2023 · 5 comments

Comments

@cosminc98
Copy link

Installing "youtokentome" with pip version 23.1 fails with "ModuleNotFoundError: No module named 'Cython'" error but is successful with pip version 23.0.1.

YouTokenToMe Version: 1.0.6
Python Version: 3.9.13
Setuptools Version: 67.7.1
Cython Version: 0.29.34
OS: AlmaLinux release 8.7 (Stone Smilodon)

Running with pip 23.1 (last release at the time of writing):

python3.9 -m venv venv
source venv/bin/activate
pip install -U pip setuptools # pip-23.1 setuptools-67.7.1
pip install Cython
pip install youtokentome

Gives the following error:

Collecting youtokentome
  Using cached youtokentome-1.0.6.tar.gz (86 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [17 lines of output]
      Traceback (most recent call last):
        File "/data/venv/lib64/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/data/venv/lib64/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/data/venv/lib64/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-e96nfhi5/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "/tmp/pip-build-env-e96nfhi5/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-e96nfhi5/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 487, in run_setup
          super(_BuildMetaLegacyBackend,
        File "/tmp/pip-build-env-e96nfhi5/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line 5, in <module>
      ModuleNotFoundError: No module named 'Cython'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Running with pip 23.0.1 (second to last release):

python3.9 -m venv venv
source venv/bin/activate
pip install -U setuptools # setuptools-67.7.1
pip install pip==23.0.1 
pip install Cython
pip install youtokentome

Installing "youtokentome" now is successful:

Collecting youtokentome
  Using cached youtokentome-1.0.6.tar.gz (86 kB)
  Preparing metadata (setup.py) ... done
Collecting Click>=7.0
  Using cached click-8.1.3-py3-none-any.whl (96 kB)
Installing collected packages: Click, youtokentome
  DEPRECATION: youtokentome is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for youtokentome ... done
Successfully installed Click-8.1.3 youtokentome-1.0.6

The result of "pip freeze" at the end of both sets of commands:

# for the one with pip 23.1
Cython==0.29.34

# for the one with pip 23.0.1
lick==8.1.3
Cython==0.29.34
youtokentome==1.0.6

The error happens at this line of code in setuptools that runs the code in the setup.py script of "youtokentome". To be exact, the error is at line 5 in setup.py.

@cosminc98
Copy link
Author

This warning may be related:

DEPRECATION: youtokentome is being installed using the legacy 'setup.py install' method, because it 
does not have a 'pyproject.toml' and the 'wheel' package is not installed. 
pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. 
Discussion can be found at https://github.com/pypa/pip/issues/8559

@fquirin
Copy link

fquirin commented Apr 30, 2023

I can confirm this error with pip 23.1. Had to downgrade to 23.0.1 to make youtokentome work 😑

@cosminc98
Copy link
Author

The problem seems to disappear after installing "wheel" (see this issue):

pip install wheel
pip install Cython
pip install youtokentome

Works with pip 23.1.2.

@fquirin
Copy link

fquirin commented May 18, 2023

I usually install wheel via apt install python3-wheel. Didn't expect that pip install wheel would make a difference :-|.

@bradley
Copy link

bradley commented Oct 13, 2023

The problem seems to disappear after installing "wheel" (see this issue):

pip install wheel
pip install Cython
pip install youtokentome

Works with pip 23.1.2.

lifesaver. thank you @cosminc98

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants