pundler icon indicating copy to clipboard operation
pundler copied to clipboard

distutils.errors.DistutilsOptionError: can't combine user with prefix, exec_prefix/home, or install_(plat)base

Open kepi opened this issue 7 years ago • 2 comments

Hello,

I tried to create simple requirements.txt file where there is only one line matrix_client.

~/tmpfs/test  
❯ cat requirements.txt 
matrix_client

~/tmpfs/test  
❯ pundle
Install some packages
try <pip._vendor.distlib.locators.SimpleScrapingLocator object at 0x7fe1c9230610> for matrix_client
Collecting matrix-client==0.3.2 from https://files.pythonhosted.org/packages/6b/0b/65dc841fd3d14e7ebc6081bbfce23365a6b2f68cc6ae2ae2d1d7d59570cd/matrix_client-0.3.2-py2.py3-none-any.whl
  Using cached https://files.pythonhosted.org/packages/6b/0b/65dc841fd3d14e7ebc6081bbfce23365a6b2f68cc6ae2ae2d1d7d59570cd/matrix_client-0.3.2-py2.py3-none-any.whl
Installing collected packages: matrix-client
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 360, in run
    prefix=options.prefix_path,
  File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 247, in move_wheel_files
    prefix=prefix,
  File "/usr/lib/python2.7/dist-packages/pip/locations.py", line 153, in distutils_scheme
    i.finalize_options()
  File "/usr/lib/python2.7/distutils/command/install.py", line 289, in finalize_options
    raise DistutilsOptionError("can't combine user with prefix, "
DistutilsOptionError: can't combine user with prefix, exec_prefix/home, or install_(plat)base
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/kepi/.local/lib/python2.7/site-packages/pundle.py", line 1250, in <module>
    CmdRegister.main()
  File "/home/kepi/.local/lib/python2.7/site-packages/pundle.py", line 1025, in main
    cls.commands[alias]()
  File "/home/kepi/.local/lib/python2.7/site-packages/pundle.py", line 1031, in cmd_install
    install_all(**create_parser_or_exit())
  File "/home/kepi/.local/lib/python2.7/site-packages/pundle.py", line 908, in install_all
    suite.install()
  File "/home/kepi/.local/lib/python2.7/site-packages/pundle.py", line 467, in install
    state.reveal_requirements(self, install=install)
  File "/home/kepi/.local/lib/python2.7/site-packages/pundle.py", line 327, in reveal_requirements
    dist = self.check_installed_version(suite, install=install)
  File "/home/kepi/.local/lib/python2.7/site-packages/pundle.py", line 299, in check_installed_version
    self.frozen = dist.version
AttributeError: 'NoneType' object has no attribute 'version'

System is Debian Linux (Unstable), python is installed from distribution. Same problem is with python3.

It is probably some problem with distutils configuration or something like that. I tried to search if I had some user configuration changes but I didn't find any.

I found this: https://stackoverflow.com/questions/4495120/combine-user-with-prefix-error-with-setup-py-install but creating that config file didn't help and more, I'm not sure what will be other sideeffects.

kepi avatar Sep 18 '18 15:09 kepi

pundle uses --target pip feature to install package to dedicated path. So somewhere in your system --user option is configured. You need to turn it off. Also you can give a try to pyenv. I personally do not like system python distributions, especially from debian guys.

Deepwalker avatar Sep 21 '18 17:09 Deepwalker

python3 -m pip install --system -r requirements.txt -t $(pwd)

codecakes avatar Apr 17 '20 17:04 codecakes