72

I'm trying do from Cython.Build import cythonize and I get the message ImportError: No module named 'Cython', but I installed the Cython with the comand pip install Cython. What's wrong?

Python 3.5 Cython 0.25.2 Windows 8

vvvvv
  • 25,404
  • 19
  • 49
  • 81
Tais
  • 959
  • 1
  • 6
  • 12

7 Answers7

71

Just directly install from pypi:

pip install Cython

https://pypi.org/project/Cython/

vvvvv
  • 25,404
  • 19
  • 49
  • 81
Xiaoyu Xu
  • 858
  • 6
  • 5
45

Use Pip3 command:

pip3 install --upgrade cython
DavidW
  • 29,336
  • 6
  • 55
  • 86
baraa yusri
  • 469
  • 4
  • 7
  • I've undone an edit that changed `pip3` -> `pip` since it seems to change the point of this answer. The useful bit of the edit was to suggest (that on some shells) `alias pip=pip3` (for those that want to only type `pip`). – DavidW Jan 28 '21 at 15:48
9

I reinstalled the Cython with conda and install the Microsoft Visual C++ Build Tools and it works fine.

Jeru Luke
  • 20,118
  • 13
  • 80
  • 87
Tais
  • 959
  • 1
  • 6
  • 12
9

The problem for me was the pip version. Running python -m pip install pip --upgrade solved the issue.

Charalamm
  • 1,547
  • 1
  • 11
  • 27
5

You can download the the newest Cython release from http://cython.org/ or you can directly download by clicking this link here Unpack the tarball or zip file, enter the directory, and then run:

python setup.py install
JohannesB
  • 1,995
  • 21
  • 35
Pranav balu
  • 126
  • 1
  • 5
3

I personally ran into this problem when I was trying to set up a new virtual environment. I simply installed Cython with python -m pip install Cython and then proceeded to install all the rest of my stuff I needed with python -m pip install -r requirements.txt. Once it was done, it actually uninstalled Cython for me... Why? Heck do I know... I ain't that kind of expert :<

W1ck3d
  • 324
  • 1
  • 10
1

it should be path problem. go to windows search for python idle right click idle - open file location where right click on python.exe - open file location if the module not in that location type cmd and press enter in path now install module with pip install cython it will work fine