I started a new project and wanted to create a virtual environment via pipenv as I have been doing for the last seven times. I am a beginner/novice to pipenv, but manage to get the things to do what I want and have not experienced any major problem before I could not solve on my own. I really enjoy not having tons of dependencies installed on my system, and would like to stick with a virtual environment.
To create the problem I simply have to generate a new lock file in a fresh folder with or without files beforehand. Already generated lockfiles work without errors (have not tried installing new dependencies in older project).
terminal
-> workspace pipenv lock
Creating a virtualenv for this project…
Pipfile: /home/djursing/workspace/Pipfile
Using /usr/bin/python3 (3.6.7) to create virtualenv…
⠋ Creating virtual environment...Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/djursing/.local/share/virtualenvs/workspace-kiFyzAmW/bin/python3
✘ Failed creating virtual environment
[pipenv.exceptions.VirtualenvCreationException]: File "/home/djursing/.local/lib/python3.6/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
[pipenv.exceptions.VirtualenvCreationException]: return f(get_current_context(), *args, **kwargs)
[pipenv.exceptions.VirtualenvCreationException]: File "/home/djursing/.local/lib/python3.6/site-packages/pipenv/cli/command.py", line 319, in lock
[pipenv.exceptions.VirtualenvCreationException]: ensure_project(three=state.three, python=state.python, pypi_mirror=state.pypi_mirror)
[pipenv.exceptions.VirtualenvCreationException]: File "/home/djursing/.local/lib/python3.6/site-packages/pipenv/core.py", line 574, in ensure_project
[pipenv.exceptions.VirtualenvCreationException]: pypi_mirror=pypi_mirror,
[pipenv.exceptions.VirtualenvCreationException]: File "/home/djursing/.local/lib/python3.6/site-packages/pipenv/core.py", line 506, in ensure_virtualenv
[pipenv.exceptions.VirtualenvCreationException]: python=python, site_packages=site_packages, pypi_mirror=pypi_mirror
[pipenv.exceptions.VirtualenvCreationException]: File "/home/djursing/.local/lib/python3.6/site-packages/pipenv/core.py", line 935, in do_create_virtualenv
[pipenv.exceptions.VirtualenvCreationException]: extra=[crayons.blue("{0}".format(c.err)),]
[pipenv.exceptions.VirtualenvCreationException]: Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/djursing/.local/lib/python3.6/site-packages/virtualenv.py", line 2502, in <module>
main()
File "/home/djursing/.local/lib/python3.6/site-packages/virtualenv.py", line 793, in main
symlink=options.symlink,
File "/home/djursing/.local/lib/python3.6/site-packages/virtualenv.py", line 1070, in create_environment
install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages=site_packages, clear=clear, symlink=symlink)
File "/home/djursing/.local/lib/python3.6/site-packages/virtualenv.py", line 1392, in install_python
shutil.copyfile(executable, py_executable)
File "/usr/lib/python3.6/shutil.py", line 121, in copyfile
with open(dst, 'wb') as fdst:
OSError: [Errno 26] Text file busy: '/home/djursing/.local/share/virtualenvs/workspace-kiFyzAmW/bin/python3'
Failed to create virtual environment.
I expected the lockfile to and I would be on my way to install the desired dependencies for my project, but I am instead stuck at this error. I have very little knowledge of general system management, which is why I try to stay away from installing dependencies/packages system wide.
I have checked out the thread named: "OError: [Errno 26] Text file busy: '/…myvirtualenv/bin/python'", but got me no closer to solve the problem.
Hope someone is able to help me.