Unable to import module in setup.py (using setuptools and pyproject.toml) #3868
-
I am currently using setuptools to build and install a package using a I currently have the following tree
In the
The purpose is to install package I have added the following line in
and
I run the setup using
Is it possible to import module in |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @luclaurent, If you need the project directory to be added to import os, sys
sys.path.insert(0, os.path.dirname(__file__))
... (Please double check because I wrote this from the top of my head) |
Beta Was this translation helpful? Give feedback.
Hi @luclaurent,
pip
uses PEP 517 hooks to call setuptools and no longer runs deprecatedpython setup.py ...
command. This impacts on the waysys.path
is processed by Python.If you need the project directory to be added to
sys.path
, I recommend you explicitly doing that in yoursetup.py
before the other imports. Something like:(Please double check because I wrote this from the top of my head)