question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot install a wheel package in a directory with whitespaces

See original GitHub issue

Summary

  • If the name of current working directory contains the whitespaces
  • You won’t be able to install a package with the wheel format.

This bug occurs regardless of the value of PIPENV_VENV_IN_PROJECT environment variable.

How to reproduce this error

Please comment if you cannot reproduce the error.

$ mkdir 'directory with spaces'
$ cd 'directory with spaces/'


$ pipenv --three
Creating a Pipfile for this project...
Creating a virtualenv for this project...
⠋Running virtualenv with interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/simnalamburt/.local/share/virtualenvs/directory with spaces/bin/python3
Also creating executable in /home/simnalamburt/.local/share/virtualenvs/directory with spaces/bin/python
Installing setuptools, pip, wheel...done.

Virtualenv location:


$ pipenv install numpy
Creating a virtualenv for this project...
⠋Using base prefix '/usr'
New python executable in /home/simnalamburt/.local/share/virtualenvs/directory with spaces/bin/python
Traceback (most recent call last):
  File "/usr/bin/virtualenv", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python3.6/site-packages/virtualenv.py", line 713, in main
    symlink=options.symlink)
  File "/usr/lib/python3.6/site-packages/virtualenv.py", line 925, in create_environment
    site_packages=site_packages, clear=clear, symlink=symlink))
  File "/usr/lib/python3.6/site-packages/virtualenv.py", line 1370, in install_python
    os.symlink(py_executable_base, full_pth)
FileExistsError: [Errno 17] File exists: 'python' -> '/home/simnalamburt/.local/share/virtualenvs/directory with spaces/bin/python3.6'

Virtualenv location:
Installing numpy...
Collecting numpy
  Using cached numpy-1.12.0-cp36-cp36m-manylinux1_x86_64.whl
Installing collected packages: numpy

Error:  An error occurred while installing numpy!
Exception:
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python3.6/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/usr/lib/python3.6/site-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/usr/lib/python3.6/site-packages/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/usr/lib/python3.6/site-packages/pip/wheel.py", line 316, in clobber
    ensure_dir(destdir)
  File "/usr/lib/python3.6/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "/usr/lib/python3.6/os.py", line 220, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/usr/lib/python3.6/site-packages/numpy-1.12.0.dist-info'
screenshot *(Click to see the screenshot)*

My Environment

I could reproduce the error in multiple environments. Please comment if you want more information.

$ uname -a
Linux 4.9.6-1-ARCH #1 SMP PREEMPT Thu Jan 26 09:22:26 CET 2017 x86_64 GNU/Linux
$ python3 --version
Python 3.6.0
$ pipenv --version
pipenv, version 3.4.1
$ uname -a
Darwin 16.4.0 Darwin Kernel Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64 x86_64
$ python3 --version
Python 3.6.0
$ pipenv --version
pipenv, version 3.4.1

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
kennethreitzcommented, Feb 20, 2017

i don’t personally think this is the right approach, having the project virtualenv named after the project directory is important

0reactions
kennethreitzcommented, Feb 20, 2017

but we can do it it in exceptional cases, perhaps, like when there’s a space.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Could not install packages due to an EnvironmentError: [Errno ...
Most likely it is trying to download the data to your /tmp temporary location. My guess is that the default settings (usually half...
Read more >
Cannot install pip module because there is 'no space' left on ...
The most likely cause is lack of space in /tmp . The workaround is to instruct pip to use an alternative folder.
Read more >
Using wheel files with conda
The second best way is to build a conda package from the wheel file. This tells conda more about the files present than...
Read more >
White-space in file path causes error when installing/updating ...
My windows username is my real name with a whitespace between. From R 3.6.2 (I think) onwards, this has been an issue with...
Read more >
Python and Virtual Environments - CS Guide
We no longer install packages at the system level and, ... source tarball,” and put it in a temporary directory in your project...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found