I seem to get errors when installing django with the following commands. I follow the instructions form the book i am using exactly but get errors. First installing pipenv gave me errors about path and updating the paths in windows manually fixed that.
pip3 install pipenv <---- executes correlty with no errors
pipenv install django ~=3.1.0 <----- get the following errors below
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2800.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2800.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\zzzz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts\pipenv.exe\__main__.py", line 7, in <module>
File "C:\Users\zzzz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\click\core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "C:\Users\zzzz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\click\core.py", line 1053, in main
rv = self.invoke(ctx)
File "C:\Users\zzzz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\click\core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\zzzz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\click\core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\zzzz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\click\core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "C:\Users\zzzz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\click\decorators.py", line 84, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "C:\Users\zzzz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\click\core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "C:\Users\zzzz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\cli\command.py", line 194, in install
do_install(
File "C:\Users\zzzz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\core.py", line 2046, in do_install
pkg_requirement = Requirement.from_line(pkg_line)
File "C:\Users\zzzz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\requirementslib\models\requirements.py", line 2674, in from_line
parsed_line = Line(line)
File "C:\Users\zzzz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\requirementslib\models\requirements.py", line 171, in __init__
self.parse()
File "C:\Users\zzzz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\requirementslib\models\requirements.py", line 1304, in parse
self.parse_name()
File "C:\Users\zzzz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\requirementslib\models\requirements.py", line 1027, in parse_name
name = self._parse_name_from_line()
File "C:\Users\zzzz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pipenv\vendor\requirementslib\models\requirements.py", line 968, in _parse_name_from_line
raise RequirementError(
pipenv.vendor.requirementslib.exceptions.RequirementError: Failed parsing requirement from 'C:\\Users\\=3.1.0'
any help would be appreciated. I have disabled windows defender just encase it was a internet access isue even though the error does not report as such. I am running all commands through windwos power shell as administrator. I am using python 3.9
I cant seem to find anyone with similar problem online. Would appreciate some help
Thank you
https://virtualenvwrapper.readthedocs.io/en/latest/install.html
Make new env
Mkvirtualenv test
pip install django
Just encase anyone is interested in why I was encountering the above error, it was because of the space between django and ~ .
pipenv install django ~=3.1.0 <------ gave me errors
pipenv install django~=3.1.0 <----- everything was fine.
Related
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.
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!
I'm sorry if I didn't speak well in English because I'm not good at English.
Specifically, the environment was being constructed with reference to this article.
The error occurred when 「pipenv install gunicorn」 command was executed to introduce “gunicorn”.
The execution result of 「pipenv install gunicorn」 is as follows.
/home/app-user/.local/python/lib/python3.7/site-packages/pipenv/vendor/attr/_make.py:618: RuntimeWarning: Missing ctypes. Some features like bare super() or accessing __class__ will not work with slots classes.
set_closure_cell(cell, cls)
Installing gunicorn…
Traceback (most recent call last):
File "/home/app-user/.local/python/bin/pipenv", line 10, in <module>
sys.exit(cli())
File "/home/app-user/.local/python/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/home/app-user/.local/python/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/home/app-user/.local/python/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/app-user/.local/python/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/app-user/.local/python/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/home/app-user/.local/python/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/home/app-user/.local/python/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/home/app-user/.local/python/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/app-user/.local/python/lib/python3.7/site-packages/pipenv/cli/command.py", line 254, in install
editable_packages=state.installstate.editables,
File "/home/app-user/.local/python/lib/python3.7/site-packages/pipenv/core.py", line 1909, in do_install
pkg_requirement = Requirement.from_line(pkg_line)
File "/home/app-user/.local/python/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 1068, in from_line
if isinstance(line, pip_shims.shims.InstallRequirement):
File "/home/app-user/.local/python/lib/python3.7/site-packages/pipenv/vendor/pip_shims/shims.py", line 254, in __getattr__
return super(_shims, self).__getattribute__(*args, **kwargs)
AttributeError: '_shims' object has no attribute 'InstallRequirement'
We would appreciate your help in resolving the above error.
Thank you.
If you are using Pyenv for python version management you can follow the following steps:
Make sure that you have correctly setup pyenv and you have following lines in either bashrc, bash_profile or zshrc; depending upon your operating system and shell. For more information check documentation
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
Remove the old python installation using pyenv unistall X.X.X where X.X.X is the version number of python.
Reinstall the python using pyenv install X.X.X
I am getting the following error message when trying mlflow examples and running 'mlflow ui'.
Error:
ModuleNotFoundError: No module named 'fcntl' Running the mlflow server
failed. Please see the logs above for details
Is anyone aware of a solution to this issue?
I have tried the solutions suggested at https://github.com/mlflow/mlflow/pull/1080
without success. Replacing the modified files in mlflow source code, it raises other issues for not finding what it is looking for with the following:
Traceback (most recent call last):
File "c:\programdata\anaconda3\envs\thesis_mlflow\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\programdata\anaconda3\envs\thesis_mlflow\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\ProgramData\Anaconda3\envs\thesis_mlflow\Scripts\mlflow.exe\__main__.py", line 9, in <module>
File "c:\programdata\anaconda3\envs\thesis_mlflow\lib\site-packages\click\core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "c:\programdata\anaconda3\envs\thesis_mlflow\lib\site-packages\click\core.py", line 717, in main
rv = self.invoke(ctx)
File "c:\programdata\anaconda3\envs\thesis_mlflow\lib\site-packages\click\core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\programdata\anaconda3\envs\thesis_mlflow\lib\site-packages\click\core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\programdata\anaconda3\envs\thesis_mlflow\lib\site-packages\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "c:\programdata\anaconda3\envs\thesis_mlflow\lib\site-packages\mlflow\cli.py", line 198, in ui
_run_server(backend_store_uri, default_artifact_root, "127.0.0.1", port, None, 1)
File "c:\programdata\anaconda3\envs\thesis_mlflow\lib\site-packages\mlflow\server\__init__.py", line 90, in _run_server
exec_cmd(full_command, env=env_map, stream_output=True)
File "c:\programdata\anaconda3\envs\thesis_mlflow\lib\site-packages\mlflow\utils\process.py", line 34, in exec_cmd
stdin=subprocess.PIPE, **kwargs)
File "c:\programdata\anaconda3\envs\thesis_mlflow\lib\subprocess.py", line 729, in __init__
restore_signals, start_new_session)
File "c:\programdata\anaconda3\envs\thesis_mlflow\lib\subprocess.py", line 1017, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
Just solved the issue: for some reason, waitress was not installed in the running environment. After installing it, everything seems working fine with the solution #1080 linked above in the question.
Perform the following installation before executing the mlflow ui command:
pip install waitress
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