Chris PERE
Chris PERE

Reputation: 722

ModuleNotFoundError: No module named 'Cython' during pycocotools install after cython installation

I have a problem trying to install pycocotools in environment with python 3.6.9.

I'm running ubuntu 18.04 on my windows 10. I've created an environment and activated it. I want to install packages and I use :

pip install <package> --user

When I install cython it's working perfectly but, when I install pycocotools :

pip install pycocotools --user

I have the error follow :

Downloading https://files.pythonhosted.org/packages/96/84/9a07b1095fd8555ba3f3d519517c8743c2554a245f9476e5e39869f948d2/pycocotools-2.0.0.tar.gz (1.5MB)
100% |████████████████████████████████| 1.5MB 1.9MB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-build-mut7_bkf/pycocotools/setup.py", line 2, in <module>
    from Cython.Build import cythonize
ModuleNotFoundError: No module named 'Cython'

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-mut7_bkf/pycocotools/

I don't understand the error because cython is installed before and I haven't error message during the installation.

Update 1

The problem is still here when I use

python3 -m pip install 

But, I have something interesting. In the active environment :

@ : python3 -m pip --version
@ : pip 9.0.1 from /env/lib/python3.6/site-packages (python 3.6)

@ : python3 -m pip install --upgrade pip --user
/env/share/python-wheels/urllib3-1.22-py2.py3-none-any.whl/urllib3/connectionpool.py:860: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
Collecting pip
/env/share/python-wheels/urllib3-1.22-py2.py3-none-any.whl/urllib3/connectionpool.py:860: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
/env/share/python-wheels/urllib3-1.22-py2.py3-none-any.whl/urllib3/connectionpool.py:860: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
Downloading https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl (1.4MB)
100% |████████████████████████████████| 1.4MB 1.6MB/s
Installing collected packages: pip
Successfully installed pip-20.0.2

@ : python3 -m pip --version
@ : pip 9.0.1 from /env/lib/python3.6/site-packages (python 3.6)

So, the package is correctly downloaded and installed, but nothing change when I call it. I suspect a path difference but can not know how to resolved it.

Can someone help me ?

Best,

Chris

Upvotes: 5

Views: 8290

Answers (1)

Kalana
Kalana

Reputation: 6143

Correct installation should be like this.

pip3 install Cython

pip3 install pycocotools

If you use conda environment

conda install -c anaconda cython

conda install -c conda-forge pycocotools
conda install -c conda-forge/label/gcc7 pycocotools     #choose one of these three
conda install -c conda-forge/label/cf201901 pycocotools

update

If above statements not working that's mean you are using multiple python versions. There for specify your python version when installing any package like this.

python3.6 -m pip install cython

If you get any errors after doing these steps, please add that error log to your question

Upvotes: 3

Related Questions