I've seen this behavior with certain versions of setuptools
. If you're importing from setuptools
try importing from distutils
instead and see if that solves it.
Why would python setup.py ignore --prefix?
Question
I have a python project using setuptools via setup.py for installation. When I provide no arguments to python setup.py install
things install into the standard --user
directory in ~/.local
. However, when I provide --prefix ~/opt/myproject
, that gets ignored by the install command and things still get pushed into ~/.local
. It seems that whatever directories I specify, the 'user' scheme is selected.
I'm not doing anything special in my setup.py, but I can post whatever code is relevant to help debugging.
Solution
OTHER TIPS
Is --prefix ~/opt/myproject
exactly how your are using the command? I would recommend two things. First, the --prefix argument needs an equal sign, so it should look like this:
--prefix=~/opt/myproject
Second, I would use the full path. I'm not sure if using the ~
will work, it might, but you'll probably have better luck using the full path:
python setup.py install --prefix=/home/username/opt/myproject
You can read more about the prefix scheme here.
Do you have default options in ~/.pydistutils.cfg?