Skip to content

Unable to import module in setup.py (using setuptools and pyproject.toml) #3868

Answered by abravalheri
luclaurent asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @luclaurent, pip uses PEP 517 hooks to call setuptools and no longer runs deprecated python setup.py ... command. This impacts on the way sys.path is processed by Python.

If you need the project directory to be added to sys.path, I recommend you explicitly doing that in your setup.py before the other imports. Something like:

import os, sys
sys.path.insert(0, os.path.dirname(__file__))
...

(Please double check because I wrote this from the top of my head)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@luclaurent
Comment options

Answer selected by luclaurent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants