pypa / pipenv

Python Development Workflow for Humans.
https://pipenv.pypa.io
MIT License
24.87k stars 1.87k forks source link

pipenv check, graph, update is error #4782

Closed pplmx closed 2 years ago

pplmx commented 3 years ago

Issue description

$ pipenv check
Checking PEP 508 requirements...
Passed!
Checking installed package safety...
[JSONParseError]:   File "C:\Users\purpl\AppData\Local\Programs\Python\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 1066, in invoke
[JSONParseError]:       return ctx.invoke(self.callback, **ctx.params)
[JSONParseError]:   File "C:\Users\purpl\AppData\Local\Programs\Python\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
[JSONParseError]:       return callback(*args, **kwargs)
[JSONParseError]:   File "C:\Users\purpl\AppData\Local\Programs\Python\Python39\Lib\site-packages\pipenv\vendor\click\decorators.py", line 73, in new_func
[JSONParseError]:       return ctx.invoke(f, obj, *args, **kwargs)
[JSONParseError]:   File "C:\Users\purpl\AppData\Local\Programs\Python\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
[JSONParseError]:       return callback(*args, **kwargs)
[JSONParseError]:   File "C:\Users\purpl\AppData\Local\Programs\Python\Python39\lib\site-packages\pipenv\cli\command.py", line 514, in check
[JSONParseError]:       do_check(
[JSONParseError]:   File "C:\Users\purpl\AppData\Local\Programs\Python\Python39\lib\site-packages\pipenv\core.py", line 2692, in do_check
[JSONParseError]:       raise exceptions.JSONParseError(c.out, c.err)
Failed parsing JSON results:
ERROR: Pipenv encountered a problem and had to exit.
ERROR TEXT: Traceback (most recent call last):
  File "C:\Users\purpl\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\purpl\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\purpl\AppData\Local\Programs\Python\Python39\lib\site-packages\pipenv\patched\safety\__main__.py", line 51, in <module>
    cli(prog_name="safety")
  File "C:\Users\purpl\AppData\Local\Programs\Python\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\purpl\AppData\Local\Programs\Python\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "C:\Users\purpl\AppData\Local\Programs\Python\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\purpl\AppData\Local\Programs\Python\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\purpl\AppData\Local\Programs\Python\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "C:\Users\purpl\AppData\Local\Programs\Python\Python39\Lib\site-packages\pipenv\patched\safety\cli.py", line 63, in check
    import pkg_resources
  File "C:\Users\purpl\.virtualenvs\LearningFastAPI-vtC7bltm\lib\site-packages\pkg_resources.py", line 1479, in <module>
    register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
$ pipenv graph
[PipenvCmdError]:   File "C:\Users\purpl\AppData\Local\Programs\Python\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 1259, in invoke
[PipenvCmdError]:       return _process_result(sub_ctx.command.invoke(sub_ctx))
[PipenvCmdError]:   File "C:\Users\purpl\AppData\Local\Programs\Python\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 1066, in invoke
[PipenvCmdError]:       return ctx.invoke(self.callback, **ctx.params)
[PipenvCmdError]:   File "C:\Users\purpl\AppData\Local\Programs\Python\Python39\Lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
[PipenvCmdError]:       return callback(*args, **kwargs)
[PipenvCmdError]:   File "C:\Users\purpl\AppData\Local\Programs\Python\Python39\lib\site-packages\pipenv\cli\command.py", line 621, in graph
[PipenvCmdError]:       do_graph(bare=bare, json=json, json_tree=json_tree, reverse=reverse)
[PipenvCmdError]:   File "C:\Users\purpl\AppData\Local\Programs\Python\Python39\lib\site-packages\pipenv\core.py", line 2789, in do_graph
[PipenvCmdError]:       c = run_command(cmd_args)
[PipenvCmdError]:   File "C:\Users\purpl\AppData\Local\Programs\Python\Python39\lib\site-packages\pipenv\utils.py", line 161, in run_command
[PipenvCmdError]:       raise PipenvCmdError(cmd_string, c.out, c.err, return_code)
Error running command:  $ C:\Users\purpl\.virtualenvs\LearningFastAPI-vtC7bltm\Scripts\python.exe C:\Users\purpl\AppData\Local\Programs\Python\Python39\Lib\site-packages\pipenv\vendor\pipdeptree.py  -l
STDERR:  Traceback (most recent call last):
  File "C:\Users\purpl\AppData\Local\Programs\Python\Python39\Lib\site-packages\pipenv\vendor\pipdeptree.py", line 20, in <module>
    import pkg_resources
  File "C:\Users\purpl\.virtualenvs\LearningFastAPI-vtC7bltm\lib\site-packages\pkg_resources.py", line 1479, in <module>
    register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'

Expected result

No Error

Actual result

Error

Steps to replicate


$ pipenv --support Pipenv version: `'2021.5.29'` Pipenv location: `'C:\\Users\\purpl\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pipenv'` Python location: `'C:\\Users\\purpl\\AppData\\Local\\Programs\\Python\\Python39\\python.exe'` Python installations found: - `3.9.6`: `C:\Users\purpl\AppData\Local\Programs\Python\Python39\python.exe` PEP 508 Information: ``` {'implementation_name': 'cpython', 'implementation_version': '3.9.6', 'os_name': 'nt', 'platform_machine': 'AMD64', 'platform_python_implementation': 'CPython', 'platform_release': '10', 'platform_system': 'Windows', 'platform_version': '10.0.19043', 'python_full_version': '3.9.6', 'python_version': '3.9', 'sys_platform': 'win32'} ``` System environment variables: - `ACLOCAL_PATH` - `ALLUSERSPROFILE` - `APPDATA` - `COMMONPROGRAMFILES` - `COMPUTERNAME` - `COMSPEC` - `CONFIG_SITE` - `COMMONPROGRAMFILES(X86)` - `COMMONPROGRAMW6432` - `DISPLAY` - `DRIVERDATA` - `EXEPATH` - `GOPATH` - `HOME` - `HOMEDRIVE` - `HOMEPATH` - `HOSTNAME` - `INFOPATH` - `LANG` - `LOCALAPPDATA` - `LOGONSERVER` - `MANPATH` - `MINGW_CHOST` - `MINGW_PACKAGE_PREFIX` - `MINGW_PREFIX` - `MSYS` - `MSYSTEM` - `MSYSTEM_CARCH` - `MSYSTEM_CHOST` - `MSYSTEM_PREFIX` - `NUMBER_OF_PROCESSORS` - `OLDPWD` - `ORIGINAL_PATH` - `ORIGINAL_TEMP` - `ORIGINAL_TMP` - `OS` - `ONEDRIVE` - `ONEDRIVECONSUMER` - `PATH` - `PATHEXT` - `PKG_CONFIG_PATH` - `PLINK_PROTOCOL` - `PROCESSOR_ARCHITECTURE` - `PROCESSOR_IDENTIFIER` - `PROCESSOR_LEVEL` - `PROCESSOR_REVISION` - `PROGRAMFILES` - `PS1` - `PSMODULEPATH` - `PUBLIC` - `PWD` - `PROGRAMDATA` - `PROGRAMFILES(X86)` - `PROGRAMW6432` - `SHELL` - `SHLVL` - `SSH_ASKPASS` - `SYSTEMDRIVE` - `SYSTEMROOT` - `TEMP` - `TERM` - `TMP` - `TMPDIR` - `USERDOMAIN` - `USERDOMAIN_ROAMINGPROFILE` - `USERNAME` - `USERPROFILE` - `WINDIR` - `WSLENV` - `WT_PROFILE_ID` - `WT_SESSION` - `_` - `PIP_DISABLE_PIP_VERSION_CHECK` - `PYTHONDONTWRITEBYTECODE` - `PIP_SHIMS_BASE_MODULE` - `PIP_PYTHON_PATH` - `PYTHONFINDER_IGNORE_UNSUPPORTED` Pipenv鈥搒pecific environment variables: Debug鈥搒pecific environment variables: - `PATH`: `C:\Users\purpl\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\purpl\bin;C:\Program Files\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\Git\cmd;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Program Files\Go\bin;C:\Program Files\nodejs;C:\Program Files\dotnet;C:\Users\purpl\AppData\Local\Programs\Python\Python39\Scripts;C:\Users\purpl\AppData\Local\Programs\Python\Python39;C:\Users\purpl\AppData\Local\Microsoft\WindowsApps;C:\Users\purpl\go\bin;C:\Users\purpl\AppData\Roaming\npm;C:\Users\purpl\.dotnet\tools;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl` - `SHELL`: `C:\Program Files\Git\usr\bin\bash.exe` - `LANG`: `en_US.UTF-8` - `PWD`: `C:/Users/purpl/JetBrains/PycharmProjects/LearningFastAPI` --------------------------- Contents of `Pipfile` ('C:\\Users\\purpl\\JetBrains\\PycharmProjects\\LearningFastAPI\\Pipfile'): ```toml [[source]] url = "https://pypi.tuna.tsinghua.edu.cn/simple" verify_ssl = true name = "tsinghua" [packages] fastapi = "*" uvicorn = "*" socketio = "*" [dev-packages] [requires] python_version = "3.9" ``` Contents of `Pipfile.lock` ('C:\\Users\\purpl\\JetBrains\\PycharmProjects\\LearningFastAPI\\Pipfile.lock'): ```json { "_meta": { "hash": { "sha256": "f4ce47a4c10a93458826003b7ff35ec0b65b1a4efda12f97cc6bf713d90ac71a" }, "pipfile-spec": 6, "requires": { "python_version": "3.9" }, "sources": [ { "name": "tsinghua", "url": "https://pypi.tuna.tsinghua.edu.cn/simple", "verify_ssl": true } ] }, "default": { "asgiref": { "hashes": [ "sha256:4ef1ab46b484e3c706329cedeff284a5d40824200638503f5768edb6de7d58e9", "sha256:ffc141aa908e6f175673e7b1b3b7af4fdb0ecb738fc5c8b88f69f055c2415214" ], "markers": "python_version >= '3.6'", "version": "==3.4.1" }, "click": { "hashes": [ "sha256:8c04c11192119b1ef78ea049e0a6f0463e4c48ef00a30160c704337586f3ad7a", "sha256:fba402a4a47334742d782209a7c79bc448911afe1149d07bdabdf480b3e2f4b6" ], "markers": "python_version >= '3.6'", "version": "==8.0.1" }, "colorama": { "hashes": [ "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b", "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2" ], "markers": "platform_system == 'Windows'", "version": "==0.4.4" }, "fastapi": { "hashes": [ "sha256:644bb815bae326575c4b2842469fb83053a4b974b82fa792ff9283d17fbbd99d", "sha256:94d2820906c36b9b8303796fb7271337ec89c74223229e3cfcf056b5a7d59e23" ], "index": "tsinghua", "version": "==0.68.1" }, "h11": { "hashes": [ "sha256:36a3cb8c0a032f56e2da7084577878a035d3b61d104230d4bd49c0c6b555a9c6", "sha256:47222cb6067e4a307d535814917cd98fd0a57b6788ce715755fa2b6c28b56042" ], "markers": "python_version >= '3.6'", "version": "==0.12.0" }, "pydantic": { "hashes": [ "sha256:021ea0e4133e8c824775a0cfe098677acf6fa5a3cbf9206a376eed3fc09302cd", "sha256:05ddfd37c1720c392f4e0d43c484217b7521558302e7069ce8d318438d297739", "sha256:05ef5246a7ffd2ce12a619cbb29f3307b7c4509307b1b49f456657b43529dc6f", "sha256:10e5622224245941efc193ad1d159887872776df7a8fd592ed746aa25d071840", "sha256:18b5ea242dd3e62dbf89b2b0ec9ba6c7b5abaf6af85b95a97b00279f65845a23", "sha256:234a6c19f1c14e25e362cb05c68afb7f183eb931dd3cd4605eafff055ebbf287", "sha256:244ad78eeb388a43b0c927e74d3af78008e944074b7d0f4f696ddd5b2af43c62", "sha256:26464e57ccaafe72b7ad156fdaa4e9b9ef051f69e175dbbb463283000c05ab7b", "sha256:41b542c0b3c42dc17da70554bc6f38cbc30d7066d2c2815a94499b5684582ecb", "sha256:4a03cbbe743e9c7247ceae6f0d8898f7a64bb65800a45cbdc52d65e370570820", "sha256:4be75bebf676a5f0f87937c6ddb061fa39cbea067240d98e298508c1bda6f3f3", "sha256:54cd5121383f4a461ff7644c7ca20c0419d58052db70d8791eacbbe31528916b", "sha256:589eb6cd6361e8ac341db97602eb7f354551482368a37f4fd086c0733548308e", "sha256:8621559dcf5afacf0069ed194278f35c255dc1a1385c28b32dd6c110fd6531b3", "sha256:8b223557f9510cf0bfd8b01316bf6dd281cf41826607eada99662f5e4963f316", "sha256:99a9fc39470010c45c161a1dc584997f1feb13f689ecf645f59bb4ba623e586b", "sha256:a7c6002203fe2c5a1b5cbb141bb85060cbff88c2d78eccbc72d97eb7022c43e4", "sha256:a83db7205f60c6a86f2c44a61791d993dff4b73135df1973ecd9eed5ea0bda20", "sha256:ac8eed4ca3bd3aadc58a13c2aa93cd8a884bcf21cb019f8cfecaae3b6ce3746e", "sha256:e710876437bc07bd414ff453ac8ec63d219e7690128d925c6e82889d674bb505", "sha256:ea5cb40a3b23b3265f6325727ddfc45141b08ed665458be8c6285e7b85bd73a1", "sha256:fec866a0b59f372b7e776f2d7308511784dace622e0992a0b59ea3ccee0ae833" ], "markers": "python_full_version >= '3.6.1'", "version": "==1.8.2" }, "starlette": { "hashes": [ "sha256:3c8e48e52736b3161e34c9f0e8153b4f32ec5d8995a3ee1d59410d92f75162ed", "sha256:7d49f4a27f8742262ef1470608c59ddbc66baf37c148e938c7038e6bc7a998aa" ], "markers": "python_version >= '3.6'", "version": "==0.14.2" }, "typing-extensions": { "hashes": [ "sha256:49f75d16ff11f1cd258e1b988ccff82a3ca5570217d7ad8c5f48205dd99a677e", "sha256:d8226d10bc02a29bcc81df19a26e56a9647f8b0a6d4a83924139f4a8b01f17b7", "sha256:f1d25edafde516b146ecd0613dabcc61409817af4766fbbcfb8d1ad4ec441a34" ], "version": "==3.10.0.2" }, "uvicorn": { "hashes": [ "sha256:17f898c64c71a2640514d4089da2689e5db1ce5d4086c2d53699bf99513421c1", "sha256:d9a3c0dd1ca86728d3e235182683b4cf94cd53a867c288eaeca80ee781b2caff" ], "index": "tsinghua", "version": "==0.15.0" } }, "develop": {} } ```
LKI commented 3 years ago

From stackoverflow:

Faced the same problem. I think this is because python3.6 and pip3 were installed from different sources. I suggest using python's inbuilt facility to install pip i.e

python3 -m ensurepip --upgrade This should install pip3 and pip3.x where x in python3.x. Same works for python2 also.

pplmx commented 3 years ago

I tried this solution, it still didn't work.

kobayashi commented 3 years ago

How about upgrade setuptools ? python3 -m pip install --upgrade setuptools Or delete the virtual environment then create a new one.

matteius commented 2 years ago

@pplmx This very much appears like an environment issue. Also there are newer versions of pipenv you should try 2021.11.23. Since it looks like you are using system python, I would recommend upgrading pip, and upgrading setuptools.