0

I am trying to install a local package in python by running

pip install -e .

in the folder containing setup.py. Doing so works fine.

as part of the installation I want to run a few addition commands which involve external packages. So as part of my setup.py I would like to import those packages (e.g. pandas). However, when trying to run the installation with this import I get the following error:

ModuleNotFoundError: No module named 'pandas'

I suspected that the problem was simply being caused by an incorrect version of python being called so I checked this by writing sys.executable to a file. When I open a python REPL from sys.executable in terminal I can import pandas.

Any ideas what could be causing this?!

user3235916
  • 604
  • 7
  • 22
  • 1
    Does [Python packaging: build requirements in pyproject.toml VS setup_requires](https://stackoverflow.com/questions/68282771/python-packaging-build-requirements-in-pyproject-toml-vs-setup-requires) help answer your question? – kojiro Apr 13 '22 at 15:34
  • Maybe you could find answers here [ImportError: No module named pandas](https://stackoverflow.com/questions/33481974/importerror-no-module-named-pandas) [ModuleNotFoundError: No module named "pandas" en Python 3](https://es.stackoverflow.com/questions/401961/modulenotfounderror-no-module-named-pandas-en-python-3) – Hector Sanchez Apr 13 '22 at 15:37
  • 1
    have you added the `pandas` inside `setup requires` inside the `setup.py`? – Amir Shamsi Apr 13 '22 at 15:41
  • thanks @kojiro and Amir Shamisi. I am new to packaging to didn't know this was required. This solves my issue. Thanks! – user3235916 Apr 13 '22 at 15:47

0 Answers0