FileNotFoundError: [Errno 2] using Pipenv - python

I'm trying to install dependencies in django using pipenv install.
Then it responded error message like this in Ubuntu 22.04 LTS. Does file path in wrong or installation incomplete?
Python version - 3.10.4, pip version - pip 22.0.4 from /usr/local/lib/python3.10/dist-packages/pip (python 3.10)
/home/username/.local/lib/python3.10/site-packages/pkg_resources/__init__.py:123: PkgResourcesDeprecationWarning: 1.1build1 is an invalid version and will not be supported in a future release
warnings.warn(
/home/username/.local/lib/python3.10/site-packages/pkg_resources/__init__.py:123: PkgResourcesDeprecationWarning: 0.1.43ubuntu1 is an invalid version and will not be supported in a future release
warnings.warn(
Creating a virtualenv for this project...
Pipfile: /home/username/Documents/codes/storefront2/Pipfile
Using /usr/bin/python3 (3.10.4) to create virtualenv...
⠏ Creating virtual environment...created virtual environment CPython3.10.4.final.0-64 in 184ms
creator CPython3Posix(dest=/home/username/.local/share/virtualenvs/storefront2-Kl67gUFU, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/username/.local/share/virtualenv)
added seed packages: pip==22.0.4, setuptools==62.1.0, wheel==0.37.1
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
✔ Successfully created virtual environment!
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 8, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.10/dist-packages/pipenv/vendor/click/core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/pipenv/cli/options.py", line 56, in main
return super().main(*args, **kwargs, windows_expand_args=False)
File "/usr/local/lib/python3.10/dist-packages/pipenv/vendor/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.10/dist-packages/pipenv/vendor/click/core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.10/dist-packages/pipenv/vendor/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.10/dist-packages/pipenv/vendor/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/pipenv/vendor/click/decorators.py", line 84, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/pipenv/vendor/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/pipenv/cli/command.py", line 222, in install
do_install(
File "/usr/local/lib/python3.10/dist-packages/pipenv/core.py", line 1964, in do_install
ensure_project(
File "/usr/local/lib/python3.10/dist-packages/pipenv/core.py", line 552, in ensure_project
ensure_virtualenv(
File "/usr/local/lib/python3.10/dist-packages/pipenv/core.py", line 485, in ensure_virtualenv
do_create_virtualenv(
File "/usr/local/lib/python3.10/dist-packages/pipenv/core.py", line 1012, in do_create_virtualenv
project._environment = Environment(
File "/usr/local/lib/python3.10/dist-packages/pipenv/environment.py", line 70, in __init__
self._base_paths = self.get_paths()
File "/usr/local/lib/python3.10/dist-packages/pipenv/environment.py", line 394, in get_paths
c = subprocess_run(command)
File "/usr/local/lib/python3.10/dist-packages/pipenv/utils/processes.py", line 75, in subprocess_run
return subprocess.run(
File "/usr/lib/python3.10/subprocess.py", line 501, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/lib/python3.10/subprocess.py", line 966, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.10/subprocess.py", line 1842, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/home/username/.local/share/virtualenvs/storefront2-Kl67gUFU/bin/python'

pip uninstall -y setuptools
corrected above for me. See FileNotFoundError: [Errno 2] when installing pipenv from pipfile for additional details

Related

errors while running pipenv on ubuntu

I want to run pipenv install on my ubuntu machine with python3.10 but I get those errors when running the command:
Installing dependencies from Pipfile.lock (17eb3b)...
Traceback (most recent call last):▉▉▉▉▉ 0/25 — 00:00:00
File "/root/.local/bin/pipenv", line 11, in <module>
sys.exit(cli())
File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "/root/.local/lib/python3.6/site-packages/pipenv/cli/options.py", line 56, in main
return super().main(*args, **kwargs, windows_expand_args=False)
File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/click/decorators.py", line 84, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/root/.local/lib/python3.6/site-packages/pipenv/cli/command.py", line 241, in install
site_packages=state.site_packages,
File "/root/.local/lib/python3.6/site-packages/pipenv/core.py", line 2102, in do_install
keep_outdated=keep_outdated,
File "/root/.local/lib/python3.6/site-packages/pipenv/core.py", line 1343, in do_init
pypi_mirror=pypi_mirror,
File "/root/.local/lib/python3.6/site-packages/pipenv/core.py", line 870, in do_install_dependencies
project, normal_deps, procs, failed_deps_queue, requirements_dir, **install_kwargs
File "/root/.local/lib/python3.6/site-packages/pipenv/core.py", line 782, in batch_install
use_pep517=use_pep517,
File "/root/.local/lib/python3.6/site-packages/pipenv/core.py", line 1519, in pip_install
include_hashes=not ignore_hashes,
File "/root/.local/lib/python3.6/site-packages/pipenv/core.py", line 1438, in write_requirement_to_file
line = requirement.line_instance.get_line(
File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 2553, in line_instance
self.line_instance = self.get_line_instance()
File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 2547, in get_line_instance
return Line(line)
File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 171, in __init__
self.parse()
File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 1289, in parse
self.parse_extras()
File "/root/.local/lib/python3.6/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 577, in parse_extras
self.line, extras = pip_shims.shims._strip_extras(self.line)
TypeError: 'NoneType' object is not callable
🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/25 —
For more information, I did run pipenv --python /usr/bin/python3.10 before that because the projects is running and build on python3.10.
Any Idea how I can fix this error?
Somebody got the same error. It looks like problem happen with pip18.1 .
So at first with run:
pipenv run pip --version
you can see your pip version and then if pipenv locking 18.1 of pip run one of the below commands:
pipenv run python -m pip install -U pip==18.0
or
pipenv run pip install pip==18.0
and after that you can probably run pipenv install successfully.
You can see more discussions for this issue in [Running pipenv gives TypeError: 'module' object is not callable].

Pipenv error when trying to uninstall dependencies

I am quite new to Python and I am trying to setup a project with pipenv. It seemed to work well, but when I tried to uninstall dependencies, I got the following error:
# pipenv uninstall flask
Uninstalling flask...
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 8, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.10/dist-packages/pipenv/vendor/click/core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/pipenv/vendor/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.10/dist-packages/pipenv/vendor/click/core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.10/dist-packages/pipenv/vendor/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.10/dist-packages/pipenv/vendor/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/pipenv/vendor/click/decorators.py", line 84, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/pipenv/vendor/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/pipenv/vendor/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/pipenv/cli/command.py", line 247, in uninstall
retcode = do_uninstall(
File "/usr/local/lib/python3.10/dist-packages/pipenv/core.py", line 2258, in do_uninstall
with project.environment.activated():
File "/usr/lib/python3.10/contextlib.py", line 135, in __enter__
return next(self.gen)
File "/usr/local/lib/python3.10/dist-packages/pipenv/environment.py", line 894, in activated
if extra_dist not in self.get_working_set():
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 629, in __contains__
return self.by_key.get(dist.key) == dist
AttributeError: 'NoneType' object has no attribute 'key'
I uninstalled and installed pipenv, but the issue persists. I am using WSL2.
I also tried uninstalling all dependencies. It have worked, but they did not disappear from the Pipfile - I am not sure if it is a separate issue, but thought it's worth mentioning.
Could someone advise? Also let me know if I missed something.
Thanks!
Try to remove the virtualenv, that pipenv creates, and after that run again pipenv install, don't forgot to remove flask from pipfile and pipfile.lock
You can try too to execute WSL with admin privileges before.

ValueError when trying to use pipenv install

I am totally new to this. So I installed pipenv using 'pip install pipenv'. I have python version 3.8.2, pip version 20.1.1 and pipenv version 2020.6.2 .
But when I try to run 'pipenv install' it gives the following error.
C:\Users\rd463>pipenv install
Traceback (most recent call last):
File "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 618, in parse_executable
result_version = get_python_version(path)
File "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\utils.py", line 105, in get_python_version
c = subprocess.Popen(version_cmd, **subprocess_kwargs)
File "d:\python382\lib\subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "d:\python382\lib\subprocess.py", line 1307, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "d:\python382\lib\runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "d:\python382\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "D:\python382\Scripts\pipenv.exe\__main__.py", line 7, in <module>
File "D:\python382\Lib\site-packages\pipenv\vendor\click\core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "D:\python382\Lib\site-packages\pipenv\vendor\click\core.py", line 782, in main
rv = self.invoke(ctx)
File "D:\python382\Lib\site-packages\pipenv\vendor\click\core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "D:\python382\Lib\site-packages\pipenv\vendor\click\core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "D:\python382\Lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "D:\python382\Lib\site-packages\pipenv\vendor\click\decorators.py", line 73, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "D:\python382\Lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "D:\python382\Lib\site-packages\pipenv\vendor\click\decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "d:\python382\lib\site-packages\pipenv\cli\command.py", line 232, in install
retcode = do_install(
File "d:\python382\lib\site-packages\pipenv\core.py", line 1921, in do_install
ensure_project(
File "d:\python382\lib\site-packages\pipenv\core.py", line 576, in ensure_project
ensure_virtualenv(
File "d:\python382\lib\site-packages\pipenv\core.py", line 498, in ensure_virtualenv
python = ensure_python(three=three, python=python)
File "d:\python382\lib\site-packages\pipenv\core.py", line 388, in ensure_python
path_to_python = find_a_system_python(python)
File "d:\python382\lib\site-packages\pipenv\core.py", line 350, in find_a_system_python
return next(iter(finder.find_all_python_versions()), None)
File "d:\python382\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 312, in find_all_python_versions
python_version_dict = getattr(self.system_path, "python_version_dict", {})
File "d:\python382\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 120, in system_path
self._system_path = self.create_system_path()
File "d:\python382\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 82, in create_system_path
return pyfinder_path.SystemPath.create(
File "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\models\path.py", line 682, in create
instance = instance._run_setup()
File "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\models\path.py", line 233, in _run_setup
new_instance = new_instance._setup_windows()
File "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\models\path.py", line 411, in _setup_windows
windows_finder = WindowsFinder.create()
File "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\models\windows.py", line 146, in create
return cls()
File "<attrs generated init pythonfinder.models.windows.WindowsFinder>", line 13, in __init__
File "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\models\windows.py", line 113, in get_versions
versions[py_version.version_tuple[:5]] = base_dir
File "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 365, in __getattribute__
result = super(PythonVersion, self).__getattribute__(key)
File "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 430, in version_tuple
self.patch,
File "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 375, in __getattribute__
instance_dict = self.parse_executable(executable)
File "D:\python382\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 620, in parse_executable
raise ValueError("Not a valid python path: %r" % path)
ValueError: Not a valid python path: 'D:/program_files/Anaconda3/Scripts/python.exe'
Running 'python -m pipenv.help' gives -
C:\Users\rd463>python -m pipenv.help
$ pipenv --support
Pipenv version: '2020.6.2'
Pipenv location: 'D:\\python382\\lib\\site-packages\\pipenv'
Python location: 'D:\\python382\\python.exe'
Python installations found:
followed by the same error again.
I have python installed in 'D:/python382'
There is no such directory that the error mentions. I have checked my environment variables and everything is fine there too. Please help me with this error.
Thank you for your time.
I think the newer version of pipenv is causing the error, I use this command when having the same issue and it worked for me, just use
pip install pipenv==2018.10.13
I had the same problem when I uninstalled Anaconda. Mine got solved after I did the following steps
run regedit.exe
Go to
Computer\HKEY_CURRENT_USER\Software\Python\PythonCore
If there is/are folders having previous versions of python.Delete every version of python other than your current one(for eg.3.7, 3.8 etc. I also had to delete some folder containing something related to anaconda to solve the problem (other than the previous versions)
I was just struggling with a similar problem with pipenv that was giving me the same error messages.
WinError 2 has to do with corrupted files in one of your Python installs/uninstalls. I searched regedit for Anaconda3 to figure out which version of Python that I had previously installed or uninstalled was causing the problem.
For me, it was Python 3.6.5. I installed it in the same location as the path in the error message (in your case that would be D:/program_files/). Then, I just uninstalled it with the installation exe, and I stopped getting these error messages.
Have you tried the conda install command? To do this, go on your anaconda prompt, cd in the folder where you have installed your anaconda. Have a look at this.
conda install -c conda-forge pipenv
make sure you activate your environment before running the conda install command. To activate your environment run conda activate envname. I hope it helps!

why am i getting this error when i am using pipenv to install scrapy?

I'm using pipenv to install scrapy on windows10 X64:
pipenv shell
pipenv install scrapy
then i get this error below:
(scrapy_demo-Nk7qjJjf) D:\PycharmProjects\scrapy_demo>pipenv install scrapy
Installing scrapy...
Traceback (most recent call last):
File "c:\users\russellxu\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\russellxu\appdata\local\programs\python\python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\RussellXu\AppData\Local\Programs\Python\Python37\Scripts\pipenv.exe\__main__.py", line 9, in <module>
File "c:\users\russellxu\appdata\local\programs\python\python37\lib\site-packages\pipenv\vendor\click\core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "c:\users\russellxu\appdata\local\programs\python\python37\lib\site-packages\pipenv\vendor\click\core.py", line 697, in main
rv = self.invoke(ctx)
File "c:\users\russellxu\appdata\local\programs\python\python37\lib\site-packages\pipenv\vendor\click\core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\users\russellxu\appdata\local\programs\python\python37\lib\site-packages\pipenv\vendor\click\core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\users\russellxu\appdata\local\programs\python\python37\lib\site-packages\pipenv\vendor\click\core.py", line 535, in invoke
return callback(*args, **kwargs)
File "c:\users\russellxu\appdata\local\programs\python\python37\lib\site-packages\pipenv\cli.py", line 435, in install
selective_upgrade=selective_upgrade,
File "c:\users\russellxu\appdata\local\programs\python\python37\lib\site-packages\pipenv\core.py", line 1971, in do_install
pypi_mirror=pypi_mirror,
File "c:\users\russellxu\appdata\local\programs\python\python37\lib\site-packages\pipenv\core.py", line 1375, in pip_install
package_name.split('--hash')[0].split('--trusted-host')[0]
File "c:\users\russellxu\appdata\local\programs\python\python37\lib\site-packages\pipenv\vendor\requirementslib\models\requirements.py", line 704, in from_line
line, extras = _strip_extras(line)
TypeError: 'module' object is not callable
so why am i getting this error and how can i fix it ?
Make sure pipenv is upgraded to the latest version.
If upgrading didn't work, you can try this workaround as mentioned in: https://github.com/pypa/pipenv/issues/2924#issuecomment-427351356
pip install pipenv
pipenv run pip install pip==18.0
pipenv install

Unable to use pip/easy_install to install anything Linux Mint

I'm using linux mint and logged in as administrator. I have used pip to install packages before, but now whatever I try to install, i get this Error
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/dist-packages/pip-1.5.6-py2.7.egg/pip/commands/install.py", line 283, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/usr/local/lib/python2.7/dist-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 1435, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 671, in install
self.move_wheel_files(self.source_dir, root=root)
File "/usr/local/lib/python2.7/dist-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 901, in move_wheel_files
pycompile=self.pycompile,
File "/usr/local/lib/python2.7/dist-packages/pip-1.5.6-py2.7.egg/pip/wheel.py", line 215, in move_wheel_files
clobber(source, lib_dir, True)
File "/usr/local/lib/python2.7/dist-packages/pip-1.5.6-py2.7.egg/pip/wheel.py", line 205, in clobber
os.makedirs(destdir)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/IPython'
Storing debug log for failure in /home/t90/.pip/pip.log
What could be the problem?

Categories