Victor Miller
Victor Miller

Reputation: 451

virtualenv cannot create environment

I'm running on an iMac runing the latest version of catalina. I have python 3.7.5 installed via homebrew. Up to now, I've just been installing packages using sudo -H pip3 install ...

I would like to use virtualenv. I have virtualenv version 16.7.8 installed. However, when I try to create a new virtualenv in my file system, after a lot of stuff about finding files on pythonhosted, I get the trace back below. Apparently it's trying to create a subdirectory to /lib! This looks like some sort of bug. Any suggestions about tracking it down? It has created bin, lib and include subdirectories, but only lib has any files in it.

Using base prefix '/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7'
New python executable in /Users/victorsmiller/Programming/Python/tst/bin/python3.7
Also creating executable in /Users/victorsmiller/Programming/Python/tst/bin/python
Please make sure you remove any previous custom paths from your /Users/victorsmiller/.pydistutils.cfg file.
Installing setuptools, pip, wheel...

  Complete output from command /Users/victorsmiller...on/tst/bin/python3.7 - setuptools pip wheel:
  Created temporary directory: /private/var/folders/zs/sfhqf6rs4dgdjf89wmqsc6440000gn/T/pip-ephem-wheel-cache-2_g3dz1c
Created temporary directory: /private/var/folders/zs/sfhqf6rs4dgdjf89wmqsc6440000gn/T/pip-req-tracker-bxfcy5h6
Created requirements tracker '/private/var/folders/zs/sfhqf6rs4dgdjf89wmqsc6440000gn/T/pip-req-tracker-bxfcy5h6'
Created temporary directory: /private/var/folders/zs/sfhqf6rs4dgdjf89wmqsc6440000gn/T/pip-install-oboxx8ib
Looking in links: /usr/local/lib/python3.7/site-packages/virtualenv_support
1 location(s) to search for versions of setuptools:
* https://pypi.org/simple/setuptools/
Getting page https://pypi.org/simple/setuptools/
Found index url https://pypi.org/simple
Looking up "https://pypi.org/simple/setuptools/" in the cache
Request header has "max_age" as 0, cache bypassed
Starting new HTTPS connection (1): pypi.org:443
https://pypi.org:443 "GET /simple/setuptools/ HTTP/1.1" 304 0
Skipping link: not a file: /usr/local/lib/python3.7/site-packages/virtualenv_support (from -f)
Analyzing links from page https://pypi.org/simple/setuptools/
  Skipping link: unsupported archive format: .egg: https://files.pythonhosted.org/packages/77/38/90cae8fd99c5dc402d25930e1c91f5fcf6de5c8e982fd152a5a061e3df56/setuptools-0.6b1-py2.3.egg#sha256=ae0a6ec6090a92d08fe7f3dbf9f1b2ce889bce2a3d7724b62322a29b92cf93f0 (from https://pypi.org/simple/setuptools/)

and then a lot of similar lines to the last one. Then followed by:

Local files found: /usr/local/lib/python3.7/site-packages/virtualenv_support/setuptools-41.6.0-py2.py3-none-any.whl
Given no hashes to check 305 links for project 'setuptools': discarding no candidates
Using version 42.0.0 (newest of versions: 0.9.8, 1.1.6, 1.2, 1.3, 1.3.1, 1.3.2, 1.4, 1.4.1, 1.4.2, 2.0, 2.0.1, 2.0.2, 2.1, 2.1.2, 2.2, 3.1, 3.2, 3.3, 3.4, 3.4.1, 3.4.2, 3.4.3, 3.4.4, 3.5, 3.5.1, 3.5.2, 3.6, 3.7, 3.7.1, 3.8, 3.8.1, 5.0, 5.0.1, 5.0.2, 5.1, 5.2, 5.3, 5.4, 5.4.1, 5.4.2, 5.5, 5.5.1, 5.6, 5.7, 5.8, 6.0.1, 6.0.2, 6.1, 7.0, 8.0, 8.0.1, 8.0.2, 8.0.3, 8.0.4, 8.1, 8.2, 8.2.1, 8.3, 9.0, 9.0.1, 9.1, 10.0, 10.0.1, 10.1, 10.2, 10.2.1, 11.0, 11.1, 11.2, 11.3, 11.3.1, 12.0, 12.0.1, 12.0.2, 12.0.3, 12.0.4, 12.0.5, 12.1, 12.2, 12.3, 12.4, 13.0.1, 13.0.2, 14.0, 14.1, 14.1.1, 14.2, 14.3, 14.3.1, 15.0, 15.1, 15.2, 16.0, 17.0, 17.1, 17.1.1, 18.0, 18.0.1, 18.1, 18.2, 18.3, 18.3.1, 18.3.2, 18.4, 18.5, 18.6, 18.6.1, 18.7, 18.7.1, 18.8, 18.8.1, 19.0, 19.1, 19.1.1, 19.2, 19.3, 19.4, 19.4.1, 19.5, 19.6, 19.6.1, 19.6.2, 19.7, 20.0, 20.1, 20.1.1, 20.2.2, 20.3, 20.3.1, 20.4, 20.6.6, 20.6.7, 20.6.8, 20.7.0, 20.8.0, 20.8.1, 20.9.0, 20.10.1, 21.0.0, 21.1.0, 21.2.0, 21.2.1, 21.2.2, 22.0.0, 22.0.1, 22.0.2, 22.0.4, 22.0.5, 23.0.0, 23.1.0, 23.2.0, 23.2.1, 24.0.0, 24.0.1, 24.0.2, 24.0.3, 24.1.0, 24.1.1, 24.2.0, 24.2.1, 24.3.0, 24.3.1, 25.0.0, 25.0.1, 25.0.2, 25.1.0, 25.1.1, 25.1.2, 25.1.3, 25.1.4, 25.1.5, 25.1.6, 25.2.0, 25.3.0, 25.4.0, 26.0.0, 26.1.0, 26.1.1, 27.0.0, 27.1.0, 27.1.2, 27.2.0, 27.3.0, 27.3.1, 28.0.0, 28.1.0, 28.2.0, 28.3.0, 28.4.0, 28.5.0, 28.6.0, 28.6.1, 28.7.0, 28.7.1, 28.8.0, 28.8.1, 29.0.0, 29.0.1, 30.0.0, 30.1.0, 30.2.0, 30.2.1, 30.3.0, 30.4.0, 31.0.0, 31.0.1, 32.0.0, 32.1.0, 32.1.1, 32.1.2, 32.1.3, 32.2.0, 32.3.0, 32.3.1, 33.1.0, 33.1.1, 34.0.0, 34.0.1, 34.0.2, 34.0.3, 34.1.0, 34.1.1, 34.2.0, 34.3.0, 34.3.1, 34.3.2, 34.3.3, 34.4.0, 34.4.1, 35.0.0, 35.0.1, 35.0.2, 36.0.1, 36.1.0, 36.1.1, 36.2.0, 36.2.1, 36.2.2, 36.2.3, 36.2.4, 36.2.5, 36.2.6, 36.2.7, 36.3.0, 36.4.0, 36.5.0, 36.6.0, 36.6.1, 36.7.0, 36.7.1, 36.7.2, 36.8.0, 37.0.0, 38.0.0, 38.1.0, 38.2.0, 38.2.1, 38.2.3, 38.2.4, 38.2.5, 38.3.0, 38.4.0, 38.4.1, 38.5.0, 38.5.1, 38.5.2, 38.6.0, 38.6.1, 38.7.0, 39.0.0, 39.0.1, 39.1.0, 39.2.0, 40.0.0, 40.1.0, 40.1.1, 40.2.0, 40.3.0, 40.4.0, 40.4.1, 40.4.2, 40.4.3, 40.5.0, 40.6.0, 40.6.1, 40.6.2, 40.6.3, 40.7.0, 40.7.1, 40.7.2, 40.7.3, 40.8.0, 40.9.0, 41.0.0, 41.0.1, 41.1.0, 41.2.0, 41.3.0, 41.4.0, 41.5.0, 41.5.1, 41.6.0, 42.0.0)
Collecting setuptools
  Created temporary directory: /private/var/folders/zs/sfhqf6rs4dgdjf89wmqsc6440000gn/T/pip-unpack-qj_9img3
  Looking up "https://files.pythonhosted.org/packages/61/a2/82b506a6cdb42cc79a65d5a9e790112cf6b98ee7aba4a53a2b9c9c8047d0/setuptools-42.0.0-py2.py3-none-any.whl" in the cache
  Current age based on date: 3817
  Ignoring unknown cache-control directive: immutable
  Freshness lifetime from max-age: 365000000
  The response is "fresh", returning cached response
  365000000 > 3817
  Using cached https://files.pythonhosted.org/packages/61/a2/82b506a6cdb42cc79a65d5a9e790112cf6b98ee7aba4a53a2b9c9c8047d0/setuptools-42.0.0-py2.py3-none-any.whl
  Added setuptools from https://files.pythonhosted.org/packages/61/a2/82b506a6cdb42cc79a65d5a9e790112cf6b98ee7aba4a53a2b9c9c8047d0/setuptools-42.0.0-py2.py3-none-any.whl#sha256=4248cb506794bececcddeddb1678bc722f9cfcacf02f98f7c0af6b9ed893caf2 to build tracker '/private/var/folders/zs/sfhqf6rs4dgdjf89wmqsc6440000gn/T/pip-req-tracker-bxfcy5h6'
  Removed setuptools from https://files.pythonhosted.org/packages/61/a2/82b506a6cdb42cc79a65d5a9e790112cf6b98ee7aba4a53a2b9c9c8047d0/setuptools-42.0.0-py2.py3-none-any.whl#sha256=4248cb506794bececcddeddb1678bc722f9cfcacf02f98f7c0af6b9ed893caf2 from build tracker '/private/var/folders/zs/sfhqf6rs4dgdjf89wmqsc6440000gn/T/pip-req-tracker-bxfcy5h6'
1 location(s) to search for versions of pip:
* https://pypi.org/simple/pip/
Getting page https://pypi.org/simple/pip/
Found index url https://pypi.org/simple
Looking up "https://pypi.org/simple/pip/" in the cache
Request header has "max_age" as 0, cache bypassed
https://pypi.org:443 "GET /simple/pip/ HTTP/1.1" 304 0
Analyzing links from page https://pypi.org/simple/pip/
  Skipping link: No sources permitted for pip: https://files.pythonhosted.org/packages/3d/9d/1e313763bdfb6a48977b65829c6ce2a43eaae29ea2f907c8bbef024a7219/pip-0.2.tar.gz#sha256=88bb8d029e1bf4acd0e04d300104b7440086f94cc1ce1c5c3c31e3293aee1f81 (from https://pypi.org/simple/pip/)

and a lot more lines similar to the last, followed by

Found link file:///usr/local/lib/python3.7/site-packages/virtualenv_support/wheel-0.33.6-py2.py3-none-any.whl, version: 0.33.6
Local files found: /usr/local/lib/python3.7/site-packages/virtualenv_support/wheel-0.33.6-py2.py3-none-any.whl
Given no hashes to check 37 links for project 'wheel': discarding no candidates
Using version 0.33.6 (newest of versions: 0.9, 0.9.5, 0.10.0, 0.10.1, 0.10.2, 0.10.3, 0.11.0, 0.12.0, 0.13.0, 0.14.0, 0.15.0, 0.16.0, 0.17.0, 0.18.0, 0.19.0, 0.21.0, 0.22.0, 0.23.0, 0.24.0, 0.25.0, 0.26.0, 0.27.0, 0.28.0, 0.29.0, 0.30.0, 0.31.0, 0.31.1, 0.32.0, 0.32.1, 0.32.2, 0.32.3, 0.33.0, 0.33.1, 0.33.4, 0.33.5, 0.33.6)
Processing /usr/local/lib/python3.7/site-packages/virtualenv_support/wheel-0.33.6-py2.py3-none-any.whl
  Added wheel from file:///usr/local/lib/python3.7/site-packages/virtualenv_support/wheel-0.33.6-py2.py3-none-any.whl to build tracker '/private/var/folders/zs/sfhqf6rs4dgdjf89wmqsc6440000gn/T/pip-req-tracker-bxfcy5h6'
  Removed wheel from file:///usr/local/lib/python3.7/site-packages/virtualenv_support/wheel-0.33.6-py2.py3-none-any.whl from build tracker '/private/var/folders/zs/sfhqf6rs4dgdjf89wmqsc6440000gn/T/pip-req-tracker-bxfcy5h6'
Installing collected packages: setuptools, pip, wheel

ERROR: Could not install packages due to an EnvironmentError.
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/virtualenv_support/pip-19.3.1-py2.py3-none-any.whl/pip/_internal/commands/install.py", line 455, in run
    use_user_site=options.use_user_site,
  File "/usr/local/lib/python3.7/site-packages/virtualenv_support/pip-19.3.1-py2.py3-none-any.whl/pip/_internal/req/__init__.py", line 62, in install_given_reqs
    **kwargs
  File "/usr/local/lib/python3.7/site-packages/virtualenv_support/pip-19.3.1-py2.py3-none-any.whl/pip/_internal/req/req_install.py", line 861, in install
    use_user_site=use_user_site, pycompile=pycompile,
  File "/usr/local/lib/python3.7/site-packages/virtualenv_support/pip-19.3.1-py2.py3-none-any.whl/pip/_internal/req/req_install.py", line 495, in move_wheel_files
    warn_script_location=warn_script_location,
  File "/usr/local/lib/python3.7/site-packages/virtualenv_support/pip-19.3.1-py2.py3-none-any.whl/pip/_internal/wheel.py", line 461, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/usr/local/lib/python3.7/site-packages/virtualenv_support/pip-19.3.1-py2.py3-none-any.whl/pip/_internal/wheel.py", line 392, in clobber
    ensure_dir(dest)  # common for the 'include' path
  File "/usr/local/lib/python3.7/site-packages/virtualenv_support/pip-19.3.1-py2.py3-none-any.whl/pip/_internal/utils/misc.py", line 116, in ensure_dir
    os.makedirs(path)
  File "/Users/victorsmiller/Programming/Python/tst/bin/../lib/python3.7/os.py", line 211, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/Users/victorsmiller/Programming/Python/tst/bin/../lib/python3.7/os.py", line 211, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/Users/victorsmiller/Programming/Python/tst/bin/../lib/python3.7/os.py", line 221, in makedirs
    mkdir(name, mode)
OSError: [Errno 30] Read-only file system: '/lib'
Cleaning up...
Removed build tracker '/private/var/folders/zs/sfhqf6rs4dgdjf89wmqsc6440000gn/T/pip-req-tracker-bxfcy5h6'

Upvotes: 0

Views: 637

Answers (3)

Andy
Andy

Reputation: 10988

Found what was failing in my case - an earlier dist command created setup.cfg file containing:

[install]
prefix=

Removing or commenting out these lines fixed the problem.

Upvotes: 0

riter
riter

Reputation: 1

Check and uncomment out the contents of /Users/<USER_NAME>/.pydistutils.cfg

Upvotes: 0

oerbilgin
oerbilgin

Reputation: 11

I just ran into this problem, and it appears to be specific to versions >= 16.7.0. Downgrading to version 16.6.2 fixed it for me: pip install virtualenv==16.6.2

Upvotes: 1

Related Questions