2

I am writing a Cython module. I have Cython installed. The start of my setup.py file is as follows:

import os
from distutils.command.build_ext import build_ext
from typing import Callable

from setuptools import setup, Extension

from Cython.Build import cythonize

When I run pip install ., I end up with the following error:

  ModuleNotFoundError: No module named 'Cython'

However, if I run python setup.py install, everything works as expected.

I have ran pip install Cython --upgrade.

Python version: 3.7.10

Cython version: 0.29.23

pip version: 21.0.1

I am certain that more information will be needed, but not sure what I should provide.

Edit:

Python path: /Users/petioptrv/miniconda3/envs/ib-insync-sim-test/bin/python

pip path: /Users/petioptrv/miniconda3/envs/ib-insync-sim-test/bin/pip

As evident by the path, I use conda to manage my environment.

Petio Petrov
  • 123
  • 1
  • 9
  • Does the python version displayed by `pip --version` match? – SuperStormer Apr 15 '21 at 23:12
  • 2
    This is a weird one. What are the paths to the binaries (e.g. `which pip`, `which python`)? What kind of system are you on (Windows, Mac, Linux)? Do you use additional software to manage environments (`pyenv`, `conda`)? – Alexander L. Hayes Apr 15 '21 at 23:15
  • 1
    Use python -m pip install, see https://stackoverflow.com/q/25749621/5769463 – ead Apr 16 '21 at 04:24
  • @ead unfortunately, did not solve the problem – Petio Petrov Apr 18 '21 at 18:20
  • use `python3 -m pip install` ? if you have python2 installed, don't forget the **3** when you want python3 – Sylvain May 06 '21 at 17:04
  • I have the exact same issue, googling didn't help me either. Did you come by any solution by any chance @PetioPetrov ? – moinierer3000 Apr 30 '22 at 20:02
  • Update, I have found something that works for me: https://stackoverflow.com/questions/72072011/getting-modulenotfounderror-when-trying-to-import-third-party-modules-in-setup-p . Hope this will help someone. – moinierer3000 May 01 '22 at 00:15

0 Answers0