virtualenv: OSError: [Errno 30] Read-only file system

I’ve started getting a strange error when trying to create new environments:

Traceback (most recent call last):
     File "/usr/local/bin/virtualenv", line 9, in <module>
       load_entry_point('virtualenv==1.7', 'console_scripts', 'virtualenv')()
     File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 928, in main
       never_download=options.never_download)
     File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 1029, in create_environment
       site_packages=site_packages, clear=clear))
     File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 1145, in install_python
       fix_local_scheme(home_dir)
     File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 1430, in fix_local_scheme
       os.symlink(os.path.abspath(home_dir), local_path)
OSError: [Errno 30] Read-only file system

I don’t seem to have trouble creating symlinks under any other circumstances.

I’m running Ubuntu 11.04 through Virtualbox - I’ve tried destroying and rebuilding the box from scratch (using an unchanged puppet manifest), but the same error persists.

About this issue

  • Original URL
  • State: closed
  • Created 13 years ago
  • Comments: 27

Most upvoted comments

upgrade virtualenv to the latest version(1.11.6), and use it as

virtualenv --always-copy testenv

the options will not use hard link but copy the files

This can be solved on virtualbox when the issues are created by shared folders by running:

virtualenv ~/[my-env-name]
source ~/[my-env-name]/bin/activate

This won’t store your environment in your folder, but best practice is to use requirements.txt and tell your VCS to ignore your environment tree

OSError: [Errno 30] Read-only file system
if you have using shared drive inside vm and trying to execute tox inside that directory it will throw this error. Simple solution is copy that source code inside some directory in vm, lets say inside your home directory /home/sunil/projectName/ . and execute tox command inside this directory.

In my case it was setup.cfg with empty prefix= that was causing this mess.

I’m not using Virtual Box and I’m facing this issue. I don’t know why in a specific folder it doesn’t work. I did chmod and chown but It just don’t work.

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.1.1-py2.py3-none-any.whl/pip/_internal/commands/install.py", line 414, in run
    use_user_site=options.use_user_site,
  File "/usr/local/lib/python3.7/site-packages/virtualenv_support/pip-19.1.1-py2.py3-none-any.whl/pip/_internal/req/__init__.py", line 58, in install_given_reqs
    **kwargs
  File "/usr/local/lib/python3.7/site-packages/virtualenv_support/pip-19.1.1-py2.py3-none-any.whl/pip/_internal/req/req_install.py", line 920, in install
    use_user_site=use_user_site, pycompile=pycompile,
  File "/usr/local/lib/python3.7/site-packages/virtualenv_support/pip-19.1.1-py2.py3-none-any.whl/pip/_internal/req/req_install.py", line 448, in move_wheel_files
    warn_script_location=warn_script_location,
  File "/usr/local/lib/python3.7/site-packages/virtualenv_support/pip-19.1.1-py2.py3-none-any.whl/pip/_internal/wheel.py", line 426, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/usr/local/lib/python3.7/site-packages/virtualenv_support/pip-19.1.1-py2.py3-none-any.whl/pip/_internal/wheel.py", line 357, in clobber
    ensure_dir(dest)  # common for the 'include' path
  File "/usr/local/lib/python3.7/site-packages/virtualenv_support/pip-19.1.1-py2.py3-none-any.whl/pip/_internal/utils/misc.py", line 99, in ensure_dir
    os.makedirs(path)
  File "/Users/aw3/Projects/python/platzi-python/appengine_contact_server/venv/bin/../lib/python3.7/os.py", line 211, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/Users/aw3/Projects/python/platzi-python/appengine_contact_server/venv/bin/../lib/python3.7/os.py", line 211, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/Users/aw3/Projects/python/platzi-python/appengine_contact_server/venv/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/31/j0bhpp4s3qx1kcpz6fnq__b40000gn/T/pip-req-tracker-ry41njg8'
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/virtualenv.py", line 870, in main
    symlink=options.symlink,
  File "/usr/local/lib/python3.7/site-packages/virtualenv.py", line 1173, in create_environment
    install_wheel(to_install, py_executable, search_dirs, download=download)
  File "/usr/local/lib/python3.7/site-packages/virtualenv.py", line 1019, in install_wheel
    _install_wheel_with_search_dir(download, project_names, py_executable, search_dirs)
  File "/usr/local/lib/python3.7/site-packages/virtualenv.py", line 1110, in _install_wheel_with_search_dir
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=script)
  File "/usr/local/lib/python3.7/site-packages/virtualenv.py", line 963, in call_subprocess
    raise OSError("Command {} failed with error code {}".format(cmd_desc, proc.returncode))
OSError: Command /Users/aw3/Projects/...r/venv/bin/python3.7 - setuptools pip wheel failed with error code 1

I ran into the same issue. Using VBoxManage setextradata as proposed in https://www.virtualbox.org/ticket/10085 worked for me. But this is another little thing that makes the process of running a virtual local dev server unnecessary cumbersome 😃