The following hangs:
PS C:\Users\Fowler> pytest --version
Notes:
I am in Windows 10.
By hang, I mean at least 5 minutes of waiting for the pytest --version to return...
While waiting for pytest, python.exe is using 100% of a logical processor on my computer.
I uninstalled all python installations with windows installer and I reinistalled python 3.8.0 in an attempt to fix.
pytest only fails when I am not using a venv. So, pytest does work using a venv.
However, I can't use a venv with vscode, because debugging with venv gives a strange "Session-1 timed out waiting for debuggee to spawn" <-- you would think the word debuggee would be a nice clue, but not much found with that word on google. I am guessing this is a different problem, but maybe related?
In summary, I can't debug python with a venv, and I can't run pytest unit tests without a venv. Probably, these items are unrelated... But, because of this catch-22, I will be sooo grateful for any hints to fix either problem.
When I hit <ctrl-c> to break out of the pytest "hang", the following is displayed (but changes a little bit at the end each time?:
Traceback (most recent call last):
File "c:\program files\python38\lib\runpy.py", line 192, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\program files\python38\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\Fowler\AppData\Roaming\Python\Python38\Scripts\pytest.exe\__main__.py", line 7, in <module>
File "C:\Users\Fowler\AppData\Roaming\Python\Python38\site-packages\_pytest\config\__init__.py", line 72, in main
config = _prepareconfig(args, plugins)
File "C:\Users\Fowler\AppData\Roaming\Python\Python38\site-packages\_pytest\config\__init__.py", line 222, in _prepareconfig
return pluginmanager.hook.pytest_cmdline_parse(
File "C:\Users\Fowler\AppData\Roaming\Python\Python38\site-packages\pluggy\hooks.py", line 286, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "C:\Users\Fowler\AppData\Roaming\Python\Python38\site-packages\pluggy\manager.py", line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "C:\Users\Fowler\AppData\Roaming\Python\Python38\site-packages\pluggy\manager.py", line 84, in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
File "C:\Users\Fowler\AppData\Roaming\Python\Python38\site-packages\pluggy\callers.py", line 203, in _multicall
gen.send(outcome)
File "C:\Users\Fowler\AppData\Roaming\Python\Python38\site-packages\_pytest\helpconfig.py", line 89, in pytest_cmdline_parse
config = outcome.get_result()
File "C:\Users\Fowler\AppData\Roaming\Python\Python38\site-packages\pluggy\callers.py", line 80, in get_result
raise ex[1].with_traceback(ex[2])
File "C:\Users\Fowler\AppData\Roaming\Python\Python38\site-packages\pluggy\callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "C:\Users\Fowler\AppData\Roaming\Python\Python38\site-packages\_pytest\config\__init__.py", line 742, in pytest_cmdline_parse
self.parse(args)
File "C:\Users\Fowler\AppData\Roaming\Python\Python38\site-packages\_pytest\config\__init__.py", line 948, in parse
self._preparse(args, addopts=addopts)
File "C:\Users\Fowler\AppData\Roaming\Python\Python38\site-packages\_pytest\config\__init__.py", line 896, in _preparse
self.pluginmanager.load_setuptools_entrypoints("pytest11")
File "C:\Users\Fowler\AppData\Roaming\Python\Python38\site-packages\pluggy\manager.py", line 299, in load_setuptools_entrypoints
plugin = ep.load()
File "c:\program files\python38\lib\importlib\metadata.py", line 75, in load
module = import_module(match.group('module'))
File "c:\program files\python38\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "C:\Users\Fowler\AppData\Roaming\Python\Python38\site-packages\_pytest\assertion\rewrite.py", line 138, in exec_module
_write_pyc(state, co, source_stat, pyc)
File "C:\Users\Fowler\AppData\Roaming\Python\Python38\site-packages\_pytest\assertion\rewrite.py", line 274, in _write_pyc
with atomic_write(fspath(pyc), mode="wb", overwrite=True) as fp:
File "c:\program files\python38\lib\contextlib.py", line 113, in __enter__
return next(self.gen)
File "C:\Users\Fowler\AppData\Roaming\Python\Python38\site-packages\atomicwrites\__init__.py", line 156, in _open
with get_fileobject(**self._open_kwargs) as f:
File "C:\Users\Fowler\AppData\Roaming\Python\Python38\site-packages\atomicwrites\__init__.py", line 173, in get_fileobject
descriptor, name = tempfile.mkstemp(suffix=suffix, prefix=prefix,
File "c:\program files\python38\lib\tempfile.py", line 332, in mkstemp
return _mkstemp_inner(dir, prefix, suffix, flags, output_type)
File "c:\program files\python38\lib\tempfile.py", line 247, in _mkstemp_inner
file = _os.path.join(dir, pre + name + suf)
KeyboardInterrupt
The next time try to run pytest --version and I hit <ctrl-c> it ends with:
Traceback (most recent call last):
File "c:\program files\python38\lib\runpy.py", line 192, in _run_module_as_main
return _run_code(code, main_globals, None,
...
...
File "C:\Users\Fowler\AppData\Roaming\Python\Python38\site-packages\atomicwrites\__init__.py", line 173, in get_fileobject
descriptor, name = tempfile.mkstemp(suffix=suffix, prefix=prefix,
File "c:\program files\python38\lib\tempfile.py", line 332, in mkstemp
return _mkstemp_inner(dir, prefix, suffix, flags, output_type)
File "c:\program files\python38\lib\tempfile.py", line 248, in _mkstemp_inner
_sys.audit("tempfile.mkstemp", file)
KeyboardInterrupt
The next time try to run pytest --version and I hit <ctrl-c> it ends with:
Traceback (most recent call last):
File "c:\program files\python38\lib\runpy.py", line 192, in _run_module_as_main
return _run_code(code, main_globals, None,
...
...
File "C:\Users\Fowler\AppData\Roaming\Python\Python38\site-packages\atomicwrites\__init__.py", line 173, in get_fileobject
descriptor, name = tempfile.mkstemp(suffix=suffix, prefix=prefix,
File "c:\program files\python38\lib\tempfile.py", line 332, in mkstemp
return _mkstemp_inner(dir, prefix, suffix, flags, output_type)
File "c:\program files\python38\lib\tempfile.py", line 256, in _mkstemp_inner
if (_os.name == 'nt' and _os.path.isdir(dir) and
File "c:\program files\python38\lib\genericpath.py", line 42, in isdir
st = os.stat(s)
KeyboardInterrupt
The next time try to run pytest --version and I hit <ctrl-c> it ends with:
Traceback (most recent call last):
File "c:\program files\python38\lib\runpy.py", line 192, in _run_module_as_main
return _run_code(code, main_globals, None,
...
...
File "C:\Users\Fowler\AppData\Roaming\Python\Python38\site-packages\atomicwrites\__init__.py", line 173, in get_fileobject
descriptor, name = tempfile.mkstemp(suffix=suffix, prefix=prefix,
File "c:\program files\python38\lib\tempfile.py", line 332, in mkstemp
return _mkstemp_inner(dir, prefix, suffix, flags, output_type)
File "c:\program files\python38\lib\tempfile.py", line 250, in _mkstemp_inner
fd = _os.open(file, flags, 0o600)
KeyboardInterrupt
I don't know if this output will help, but I thought it might be useful to see all the locations on my machine where python and/or pytest are installed:
PS C:\Users\Fowler> where.exe /r c:\ python
c:\Program Files\Amazon\AWSCLI\runtime\python.exe
c:\Program Files\Amazon\AWSSAMCLI\runtime\python.exe
c:\Program Files\MySQL\MySQL Workbench 8.0 CE\python.exe
c:\Program Files\Python38\python.exe
c:\Program Files\Python38\Lib\venv\scripts\nt\python.exe
c:\Users\Fowler\.vscode\extensions\lextudio.restructuredtext-116.0.0\out\python.js
c:\Users\Fowler\.vscode\extensions\teabyii.ayu-0.18.0\test\Python.py
c:\Users\Fowler\.vscode\extensions\yzane.markdown-pdf-1.4.1\node_modules\highlight.js\lib\languages\python.js
c:\Users\Fowler\AppData\Local\GitHubDesktop\app-2.2.2\resources\app\highlighter\mode\python.js
c:\Users\Fowler\AppData\Local\GitHubDesktop\app-2.2.3\resources\app\highlighter\mode\python.js
c:\Users\Fowler\AppData\Local\Google\Chrome\User Data\Default\Extensions\ngkhgikojglcgnckopipfdajaifmmnnc\4.1.34_0\python.js
c:\Users\Fowler\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState\rootfs\etc\apparmor.d\abstractions\python
c:\Users\Fowler\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState\rootfs\usr\share\bash-completion\completions\python
c:\Users\Fowler\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState\rootfs\usr\share\bash-completion\helpers\python
c:\Users\Fowler\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState\rootfs\usr\share\sosreport\sos\plugins\python.py
c:\Users\Fowler\AppData\Roaming\Python\Python38\site-packages\aniso8601\builders\python.py
c:\Users\Fowler\AppData\Roaming\Python\Python38\site-packages\_pytest\python.py
c:\Users\Fowler\Documents\vscodeProjects\playarea\.venv\Scripts\python.exe
c:\Windows\Installer\$PatchCache$\Managed\8B9C64EBE8DD53846B6846E46A14F5EE\3.7.2150\python.exe
c:\Windows\Installer\$PatchCache$\Managed\9CB0624238F6F8F469EAD6566412DD7F\3.7.2150\python.exe
PS C:\Users\Fowler> where.exe /r c:\ pytest
c:\Users\Fowler\AppData\Roaming\Python\Python38\Scripts\pytest.exe
c:\Users\Fowler\AppData\Roaming\Python\Python38\site-packages\pytest.py
And finally! Whew, in case this sheds any light, here is a picture showing the python process having fun eating up my CPU during pytest.py...
I would be oh, so grateful for any assistance or thoughts!
Fixed.
The answer appears to be
Uninstall python via the windows apps and features
Remove the c:\program files\python38 directory
Remove the ..\AppData\Roaming\Python directory
Reinstall
Not sure what the "root" problem was, but a total wipe of python fixed it. Note that the python windows installer does not remove enough python stuff.
Thank you #nneonneo for getting me thinking in the right direction.
You can just run pytest from priviledged (admin) cmd for the first time. For me the issue was fixed and pytest runs from ordinary cmd now without hanging.
I have the similar problem
after i install pytest-cov or allure-pytest, pytest will hang
if i uninstall them , everything is back to normal
I have tried to install different pytest version, It didn't help
but, I tried the method you provide(uninstall python, remove the diretories), it works~, great!
but, when I install allure-pytest again, it fails again.
finally, I found that, I can't install package in privilege cmd window
If I install them in privilege cmd windows, it will make pytest hang!
so, if anyone encounter the problem I have, you can try my way.
In my case, the package anyio, a dependency of JupyterLab, was causing this problem. It was installed at the administrator level. I uninstalled it and reinstalled at the user level and pytest started working again.
Using Ubuntu 18.04/20.04 + Python 3.8.2
My tests were hanging in a similar matter after showing results.
Removing pytest-cov didn't help.
What helped was moving from Python 3.8.2 to a newer version (like 3.8.12)
I ran into the same issue. In my case my IDE didn't load the correct conda environment. So make sure you're in the right environment for your application and use conda activate myEnv to change it if necessary.
Related
I'm new to both Python and ArcGIS Pro; I'm just getting started and I'm trying to install a couple of Python packages in order to read, modify, and write Feature Class files using a Spatially Enabled DataFrame (SEDF). To do that, I need to install a couple of packages first. I've created a virtual environment in PyCharm, and was able to install a few packages, however, now when I try to install or uninstall any new packages, I get this error:
Traceback (most recent call last):
File "C:\Users\alexis\AppData\Local\Programs\Python\Python310\lib\importlib\_common.py", line 89, in _tempfile
os.write(fd, reader())
File "C:\Users\alexis\AppData\Local\Programs\Python\Python310\lib\importlib\abc.py", line 371, in read_bytes
with self.open('rb') as strm:
File "C:\Users\alexis\AppData\Local\Programs\Python\Python310\lib\importlib\_adapters.py", line 54, in open
raise ValueError()
ValueError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.3.3\plugins\python-ce\helpers\packaging_tool.py", line 114, in main
do_install(pkgs)
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.3.3\plugins\python-ce\helpers\packaging_tool.py", line 59, in do_install
run_pip(['install'] + pkgs)
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.3.3\plugins\python-ce\helpers\packaging_tool.py", line 73, in run_pip
runpy.run_module(module_name, run_name='__main__', alter_sys=True)
File "C:\Users\alexis\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 209, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "C:\Users\alexis\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 96, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "C:\Users\alexis\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\alexis\Documents\Wardrobe\Testvenv1\lib\site-packages\pip\__main__.py", line 29, in <module>
from pip._internal.cli.main import main as _main
File "C:\Users\alexis\Documents\Wardrobe\Testvenv1\lib\site-packages\pip\_internal\cli\main.py", line 9, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "C:\Users\alexis\Documents\Wardrobe\Testvenv1\lib\site-packages\pip\_internal\cli\autocompletion.py", line 10, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "C:\Users\alexis\Documents\Wardrobe\Testvenv1\lib\site-packages\pip\_internal\cli\main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "C:\Users\alexis\Documents\Wardrobe\Testvenv1\lib\site-packages\pip\_internal\cli\cmdoptions.py", line 23, in <module>
from pip._internal.cli.parser import ConfigOptionParser
File "C:\Users\alexis\Documents\Wardrobe\Testvenv1\lib\site-packages\pip\_internal\cli\parser.py", line 12, in <module>
from pip._internal.configuration import Configuration, ConfigurationError
File "C:\Users\alexis\Documents\Wardrobe\Testvenv1\lib\site-packages\pip\_internal\configuration.py", line 20, in <module>
from pip._internal.exceptions import (
File "C:\Users\alexis\Documents\Wardrobe\Testvenv1\lib\site-packages\pip\_internal\exceptions.py", line 13, in <module>
from pip._vendor.requests.models import Request, Response
File "C:\Users\alexis\Documents\Wardrobe\Testvenv1\lib\site-packages\pip\_vendor\requests\__init__.py", line 135, in <module>
from . import utils
File "C:\Users\alexis\Documents\Wardrobe\Testvenv1\lib\site-packages\pip\_vendor\requests\utils.py", line 27, in <module>
from . import certs
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "C:\Users\alexis\Documents\Wardrobe\Testvenv1\lib\site-packages\wrapt\importer.py", line 170, in exec_module
notify_module_loaded(module)
File "C:\Users\alexis\Documents\Wardrobe\Testvenv1\lib\site-packages\wrapt\decorators.py", line 470, in _synchronized
return wrapped(*args, **kwargs)
File "C:\Users\alexis\Documents\Wardrobe\Testvenv1\lib\site-packages\wrapt\importer.py", line 136, in notify_module_loaded
hook(module)
File "C:\Users\alexis\Documents\Wardrobe\Testvenv1\lib\site-packages\certifi_win32\wrapt_pip.py", line 35, in apply_patches
import certifi
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "C:\Users\alexis\Documents\Wardrobe\Testvenv1\lib\site-packages\wrapt\importer.py", line 170, in exec_module
notify_module_loaded(module)
File "C:\Users\alexis\Documents\Wardrobe\Testvenv1\lib\site-packages\wrapt\decorators.py", line 470, in _synchronized
return wrapped(*args, **kwargs)
File "C:\Users\alexis\Documents\Wardrobe\Testvenv1\lib\site-packages\wrapt\importer.py", line 136, in notify_module_loaded
hook(module)
File "C:\Users\alexis\Documents\Wardrobe\Testvenv1\lib\site-packages\certifi_win32\wrapt_certifi.py", line 20, in apply_patches
certifi_win32.wincerts.CERTIFI_PEM = certifi.where()
File "C:\Users\alexis\Documents\Wardrobe\Testvenv1\lib\site-packages\certifi\core.py", line 37, in where
_CACERT_PATH = str(_CACERT_CTX.__enter__())
File "C:\Users\alexis\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 135, in __enter__
return next(self.gen)
File "C:\Users\alexis\AppData\Local\Programs\Python\Python310\lib\importlib\_common.py", line 95, in _tempfile
os.remove(raw_path)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\alexis\\AppData\\Local\\Temp\\tmp0nrmgsas'
So far I've tried:
~Giving PyCharm Administrator permissions
~Used pip in the terminal (I always get the same error message back regardless of how I try to install/uninstall packages)
~Tried downloading other packages (same error message)
~Restarting the computer/PyCharm
~Using ArcGIS Pro to create a cloned environment GDAL, Fiona, and other packages can be installed on. However Fiona never seems to install properly, so now I'm trying to use a virtual environment in PyCharm to run the packages necessary for a Spatially Enabled DataFrame
It seems like the computer is trying to say that somehow a file is open somewhere and must be closed before it can install/uninstall anything else. However, I'm not really sure how to do that, or what that file would even be.
Despite the ValueError and PermissionError, scripts still run just fine; I just can't install or uninstall anything.
In short, I have two problems at once: (1) the package Fiona never seems to install properly, and (2) now I'm stuck with a ValueError and PermissonError that keeps me from installing/uninstalling other packages.
I'm using Python 3.10.2, PyCharm 2021.3.3, and Windows 10, 64 bit.
I've been stuck on this problem for a while now. Any advice would be much appreciated!
I've had contact with the helpdesk of Esri and they recommended using conda instead of pip to install the package. That seems to have worked for me.
Since I also would like to get it working with just pip I was able to determine that the minimal install is an option although you need to install cachetools, lxml, and requests-oauthlib even though they aren't mentioned in the instructions. That allowed me to import arcgis so it seems to have worked. I haven't had a chance to take more time with it, but perhaps this solves it for you too.
Just as a reminder, in order to fix your installation of Python you'd need to reinstall Python, but remove the Lib folder in between the un- and re-installation. (Or delete and remake the virtual environment if you used that.)
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.
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!
Im still a newbie in anaconda, python and jupyter notebook.
I am doing my assignment which is exploring anaconda and jupyter.
windows 10, 64bit
python 3.6.4
anaconda 4.4.10
Why I cant launch jupyter notebook? First time i tried it was successful. And i continue with importing the libraries. Then, when the next time i open anaconda prompt and tried jupyter notebook , i got this error:
Traceback (most recent call last):
File "C:\Users\LENOVO\Anaconda3\lib\site-packages\pkg_resources__init__.py", line 2760, in get_entry_map
ep_map = self._ep_map
File "C:\Users\LENOVO\Anaconda3\lib\site-packages\pkg_resources__init__.py", line 2731, in getattr
raise AttributeError(attr)
AttributeError: _ep_map
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\LENOVO\Anaconda3\Scripts\jupyter-notebook-script.py", line 10, in
sys.exit(main())
File "C:\Users\LENOVO\Anaconda3\lib\site-packages\jupyter_core\application.py", line 266, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "C:\Users\LENOVO\Anaconda3\lib\site-packages\traitlets\config\application.py", line 657, in launch_instance
app.initialize(argv)
File "", line 2, in initialize
File "C:\Users\LENOVO\Anaconda3\lib\site-packages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "C:\Users\LENOVO\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 1507, in initialize
self.init_webapp()
File "C:\Users\LENOVO\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 1270, in init_webapp
self.jinja_environment_options
File "C:\Users\LENOVO\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 156, in init
default_url, settings_overrides, jinja_env_options)
File "C:\Users\LENOVO\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 268, in init_settings
nbextensions_path=jupyter_app.nbextensions_path,
File "C:\Users\LENOVO\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 973, in nbextensions_path
from IPython.paths import get_ipython_dir
File "C:\Users\LENOVO\Anaconda3\lib\site-packages\IPython__init__.py", line 55, in
from .terminal.embed import embed
File "C:\Users\LENOVO\Anaconda3\lib\site-packages\IPython\terminal\embed.py", line 16, in
from IPython.terminal.interactiveshell import TerminalInteractiveShell
File "C:\Users\LENOVO\Anaconda3\lib\site-packages\IPython\terminal\interactiveshell.py", line 91, in
class TerminalInteractiveShell(InteractiveShell):
File "C:\Users\LENOVO\Anaconda3\lib\site-packages\IPython\terminal\interactiveshell.py", line 134, in TerminalInteractiveShell
highlighting: \n %s""" % ', '.join(get_all_styles())
File "C:\Users\LENOVO\Anaconda3\lib\site-packages\pygments\styles__init__.py", line 79, in get_all_styles
for name, _ in find_plugin_styles():
File "C:\Users\LENOVO\Anaconda3\lib\site-packages\pygments\plugin.py", line 62, in find_plugin_styles
for entrypoint in iter_entry_points(STYLE_ENTRY_POINT):
File "C:\Users\LENOVO\Anaconda3\lib\site-packages\pkg_resources__init__.py", line 737, in iter_entry_points
entries = dist.get_entry_map(group)
File "C:\Users\LENOVO\Anaconda3\lib\site-packages\pkg_resources__init__.py", line 2763, in get_entry_map
self._get_metadata('entry_points.txt'), self
File "C:\Users\LENOVO\Anaconda3\lib\site-packages\pkg_resources__init__.py", line 2496, in parse_map
raise ValueError("Entry points must be listed in groups")
ValueError: Entry points must be listed in groups
Is a big thank you if anyone can help me solve this! :)
Feel free to drop any comment/suggestion. Thank you!!
First of all i recommend to re install anaconda again and to select the check box which says to Set Anaconda path in system so that you can use it from anywhere.
To make sure that we are going in right direction go to the bin/ in the anaconda folder.
once you are in bin you can see that there is a jupyter-notebook.exe thus execute it in the command prompt.
Also you can try using Anaconda Navigator to do the same thing.
You can also try running it as Administrator if there are any permission issues.
There have been changes in jupyter notebooks latest release so you can read the docs for more info
I'm trying to run a setup.py script (for mnemosyne). The script fails, and I'm pretty sure I know how to fix the problem, if I could only find the file to edit. The problem is that the traceback points to a non-existent file:
File "build/bdist.macosx-10.5-x86_64/egg/macholib/MachOGraph.py", line 49, in locate
loader=loader.filename)
TypeError: dyld_find() got an unexpected keyword argument 'loader'
I believe that should be loader_path. The problem is that MachOGraph.py file doesn't exist -- not anywhere in my current path, or in my anaconda distribution. There is a build/bdist.macosx-10.5-x86_64/ directory, but no egg. There are a few MachOGraph.py files on my system, but none of them have that line. Nothing under this directory contains the string loader.filename.
What's going on? How can I find that file?
For completeness, here is the complete traceback:
Traceback (most recent call last):
File "/Users/mike/.continuum/anaconda/lib/python2.7/site-packages/ipdb/__main__.py", line 157, in main
pdb._runscript(mainpyfile)
File "/Users/mike/.continuum/anaconda/lib/python2.7/pdb.py", line 1233, in _runscript
self.run(statement)
File "/Users/mike/.continuum/anaconda/lib/python2.7/bdb.py", line 400, in run
exec cmd in globals, locals
File "<string>", line 1, in <module>
File "setup.py", line 241, in <module>
app = py2app_app
File "/Users/mike/.continuum/anaconda/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/Users/mike/.continuum/anaconda/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/Users/mike/.continuum/anaconda/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/local/src/Mnemosyne-2.3.1/py2app-0.8.1-py2.7.egg/py2app/build_app.py", line 654, in run
self._run()
File "/usr/local/src/Mnemosyne-2.3.1/py2app-0.8.1-py2.7.egg/py2app/build_app.py", line 860, in _run
self.run_normal()
File "/usr/local/src/Mnemosyne-2.3.1/py2app-0.8.1-py2.7.egg/py2app/build_app.py", line 950, in run_normal
self.create_binaries(py_files, pkgdirs, extensions, loader_files)
File "/usr/local/src/Mnemosyne-2.3.1/py2app-0.8.1-py2.7.egg/py2app/build_app.py", line 1110, in create_binaries
platfiles = mm.run()
File "build/bdist.macosx-10.5-x86_64/egg/macholib/MachOStandalone.py", line 105, in run
mm.run_file(fn)
File "build/bdist.macosx-10.5-x86_64/egg/macholib/MachOGraph.py", line 84, in run_file
self.scan_node(m)
File "build/bdist.macosx-10.5-x86_64/egg/macholib/MachOGraph.py", line 110, in scan_node
m = self.load_file(filename, caller=node)
File "build/bdist.macosx-10.5-x86_64/egg/macholib/MachOGraph.py", line 93, in load_file
newname = self.locate(name, loader=caller)
File "build/bdist.macosx-10.5-x86_64/egg/macholib/MachOStandalone.py", line 23, in locate
newname = super(FilteredMachOGraph, self).locate(filename, loader)
File "build/bdist.macosx-10.5-x86_64/egg/macholib/MachOGraph.py", line 49, in locate
loader=loader.filename)
TypeError: dyld_find() got an unexpected keyword argument 'loader'
This issue is caused by Pillow, you can use pip uninstall Pillow to uninstall it, then this question will disappear.
Python takes the filename as reported in the bytecode when printing a traceback. In this case, the bytecode contains filenames that are generated to produce a Python egg, a format that contains at least the bytecode files. These paths reflect the build directory relative to the package as it was built.
In this case, it is the py2app installer that includes macholib as a installation requirement; setuptools downloads the source code for that library and produces an egg on demand, in the same location as the py2app egg. I'd look in /usr/local/src/Mnemosyne-2.3.1/py2app-0.8.1-py2.7.egg for a macholib-1.6-py2.7.egg directory.
With macholib1.7, from line 46 of **/MachOGraph.py...:
try:
fn = dyld_find(filename, env=self.env,
executable_path=self.executable_path,
loader=loader.filename)
self.trans_table[(loader.filename, filename)] = fn
except ValueError:
return None
Change line 49 to:
loader_path=loader.filename)