Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pipenv clean should ignore and skip entries if they don’t exist #3055

Closed
whren opened this issue Oct 17, 2018 · 4 comments
Closed

pipenv clean should ignore and skip entries if they don’t exist #3055

whren opened this issue Oct 17, 2018 · 4 comments

Comments

@whren
Copy link

@whren whren commented Oct 17, 2018

Issue description

I'm under WSL 14.04, running python 3.6.6 and upgraded from pipenv 2018.7.1 to the last release, 2018.10.13.

I then try to run a pipenv clean on a virtualenv (existing or new no difference) and I'm getting an error about an include file not found.

It was working before the update of pipenv.

I've located source modification from the stacktrace coming from #2849 with the following commit

Following informations have been anonymised due to client and project informations

Expected result

pipenv clean run successfully without error

Actual result

$ pipenv clean

Traceback (most recent call last):
  File "/usr/local/bin/pipenv", line 11, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pipenv/cli/command.py", line 602, in clean
    do_clean(ctx=ctx, three=state.three, python=state.python, dry_run=dry_run)
  File "/usr/local/lib/python3.6/dist-packages/pipenv/core.py", line 2526, in do_clean
    canonicalize_name(pkg.project_name) for pkg in project.get_installed_packages()
  File "/usr/local/lib/python3.6/dist-packages/pipenv/project.py", line 320, in get_installed_packages
    packages = [pkg for pkg in workingset if self.dist_is_in_project(pkg)]
  File "/usr/local/lib/python3.6/dist-packages/pipenv/project.py", line 320, in <listcomp>
    packages = [pkg for pkg in workingset if self.dist_is_in_project(pkg)]
  File "/usr/local/lib/python3.6/dist-packages/pipenv/project.py", line 311, in dist_is_in_project
    prefix = _normalized(self.env_paths["prefix"])
  File "/usr/local/lib/python3.6/dist-packages/pipenv/project.py", line 948, in env_paths
    config.update(self._pyversion)
  File "/usr/local/lib/python3.6/dist-packages/pipenv/project.py", line 929, in _pyversion
    python_path = next(iter(list(include_dir.iterdir())), None)
  File "/usr/lib/python3.6/pathlib.py", line 1079, in iterdir
    for name in self._accessor.listdir(self):
  File "/usr/lib/python3.6/pathlib.py", line 387, in wrapped
    return strfunc(str(pathobj), *args)
FileNotFoundError: [Errno 2] No such file or directory: '/home/xxx/.local/share/virtualenvs/create-service1-EZvUL_lY/include'

Of course, no include file or directory in the virtualenv fs:

$ ls -lh /home/xxx/.local/share/virtualenvs/create-service1-EZvUL_lY
total 0
drwxrwxrwx 1 xxx xxx 512 oct.  17 11:16 bin
drwxrwxrwx 1 xxx xxx 512 oct.  17 11:16 lib
-rw-rw-rw- 1 xxx xxx  59 oct.  17 11:16 pip-selfcheck.json
drwxrwxrwx 1 xxx xxx 512 oct.  17 11:17 src

Steps to replicate

$ pipenv install

Creating a virtualenv for this project…
Pipfile: /mnt/c/Users/xxx/docker-datas/project/project-api/terraform/live/services/service1/lambdas-src/create-service1/Pipfile
Using /usr/bin/python3.6 (3.6.6) to create virtualenv…
⠦Already using interpreter /usr/bin/python3.6
Using base prefix '/usr'
New python executable in /home/xxx/.local/share/virtualenvs/create-service1-EZvUL_lY/bin/python3.6
Also creating executable in /home/xxx/.local/share/virtualenvs/create-service1-EZvUL_lY/bin/python
Installing setuptools, pip, wheel...done.

Virtualenv location: /home/xxx/.local/share/virtualenvs/create-service1-EZvUL_lY
Installing dependencies from Pipfile.lock (da2531)…
  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 1/1 — 00:00:09
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.

$ pipenv clean

$ pipenv --support

Pipenv version: '2018.10.13'

Pipenv location: '/usr/local/lib/python3.6/dist-packages/pipenv'

Python location: '/usr/bin/python3.6'

Python installations found:

  • 3.6.6: /usr/bin/python3.6
  • 3.6.6: /usr/bin/python3.6m
  • 3.6.6: /mnt/c/Users/xxx/AppData/Local/Programs/Python/Python36/python.exe
  • 3.6.6: /mnt/c/Users/xxx/AppData/Local/Programs/Python/Python36/pythonw.exe
  • 3.4.3: /usr/bin/python3.4
  • 3.4.3: /usr/bin/python3.4m
  • 2.7.6: /usr/bin/python2.7

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.6.6',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '4.4.0-17134-Microsoft',
 'platform_system': 'Linux',
 'platform_version': '#137-Microsoft Thu Jun 14 18:46:00 PST 2018',
 'python_full_version': '3.6.6',
 'python_version': '3.6',
 'sys_platform': 'linux'}

System environment variables:

  • SHELL
  • TERM
  • OLDPWD
  • USER
  • NAME
  • LS_COLORS
  • HOSTTYPE
  • PATH
  • PWD
  • LANG
  • SHLVL
  • HOME
  • LOGNAME
  • LESSOPEN
  • LESSCLOSE
  • _
  • PYTHONDONTWRITEBYTECODE
  • PIP_SHIMS_BASE_MODULE
  • PIP_PYTHON_PATH

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath_target_90724171:/mnt/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/iCLS:/mnt/c/Program Files/Intel/Intel(R) Management Engine Components/iCLS:/mnt/c/Program Files (x86)/Microsoft SDKs/Azure/CLI2/wbin:/mnt/c/ProgramData/Oracle/Java/javapath_target_91964734:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Program Files (x86)/WinMerge:/mnt/c/Donnees/006-Dev/java/tools/bin:/mnt/c/docker/03-Docker Toolbox:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/TortoiseSVN/bin:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Program Files/Microsoft DNX/Dnvm:/mnt/c/Program Files/Microsoft SQL Server/130/Tools/Binn:/mnt/c/Program Files/JQ:/mnt/c/Program Files (x86)/Symantec/VIP Access Client:/mnt/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/mnt/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/mnt/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/IPT:/mnt/c/Program Files/Intel/Intel(R) Management Engine Components/IPT:/mnt/c/ProgramData/chocolatey/bin:/mnt/c/Program Files/Microsoft VS Code/bin:/mnt/c/Windows/System32/OpenSSH:/mnt/c/Program Files/Intel/WiFi/bin:/mnt/c/Program Files/Common Files/Intel/WirelessCommon:/mnt/c/Users/xxx/AppData/Local/Programs/Python/Python36/Scripts:/mnt/c/Users/xxx/AppData/Local/Programs/Python/Python36:/mnt/c/Program Files/Intel/WiFi/bin:/mnt/c/Program Files/Common Files/Intel/WirelessCommon:/mnt/c/Users/xxx/AppData/Local/Microsoft/WindowsApps
  • SHELL: /bin/bash
  • LANG: fr_FR.UTF-8
  • PWD: /mnt/c/Users/xxx/docker-datas/project/project-api/terraform/live/services/service1/lambdas-src/create-service1

Contents of Pipfile ('/mnt/c/Users/xxx/docker-datas/project/project-api/terraform/live/services/service1/lambdas-src/create-service1/Pipfile'):

[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"

[packages]
"psycopg2-binary" = "*"

[dev-packages]
pytest = "*"
pytest-cov = "*"
pytest-env = "*"
"boto3" = "==1.7.84"

[requires]
python_version = "3.6"

Contents of Pipfile.lock ('/mnt/c/Users/xxx/docker-datas/project/project-api/terraform/live/services/service1/lambdas-src/create-service1/Pipfile.lock'):

{
    "_meta": {
        "hash": {
            "sha256": "7cb609b968e655a344909adbd04d2a6d055973bff0dbdc7bea7b3ed1dada2531"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.6"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.python.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {
        "psycopg2-binary": {
            "hashes": [
                "sha256:04afb59bbbd2eab3148e6816beddc74348078b8c02a1113ea7f7822f5be4afe3",
                "sha256:098b18f4d8857a8f9b206d1dc54db56c2255d5d26458917e7bcad61ebfe4338f",
                "sha256:0bf855d4a7083e20ead961fda4923887094eaeace0ab2d76eb4aa300f4bbf5bd",
                "sha256:197dda3ffd02057820be83fe4d84529ea70bf39a9a4daee1d20ffc74eb3d042e",
                "sha256:278ef63afb4b3d842b4609f2c05ffbfb76795cf6a184deeb8707cd5ed3c981a5",
                "sha256:3cbf8c4fc8f22f0817220891cf405831559f4d4c12c4f73913730a2ea6c47a47",
                "sha256:4305aed922c4d9d6163ab3a41d80b5a1cfab54917467da8168552c42cad84d32",
                "sha256:47ee296f704fb8b2a616dec691cdcfd5fa0f11943955e88faa98cbd1dc3b3e3d",
                "sha256:4a0e38cb30457e70580903367161173d4a7d1381eb2f2cfe4e69b7806623f484",
                "sha256:4d6c294c6638a71cafb82a37f182f24321f1163b08b5d5ca076e11fe838a3086",
                "sha256:4f3233c366500730f839f92833194fd8f9a5c4529c8cd8040aa162c3740de8e5",
                "sha256:5221f5a3f4ca2ddf0d58e8b8a32ca50948be9a43351fda797eb4e72d7a7aa34d",
                "sha256:5c6ca0b507540a11eaf9e77dee4f07c131c2ec80ca0cffa146671bf690bc1c02",
                "sha256:789bd89d71d704db2b3d5e67d6d518b158985d791d3b2dec5ab85457cfc9677b",
                "sha256:7b94d29239efeaa6a967f3b5971bd0518d2a24edd1511edbf4a2c8b815220d07",
                "sha256:89bc65ef3301c74cf32db25334421ea6adbe8f65601ea45dcaaf095abed910bb",
                "sha256:89d6d3a549f405c20c9ae4dc94d7ed2de2fa77427a470674490a622070732e62",
                "sha256:97521704ac7127d7d8ba22877da3c7bf4a40366587d238ec679ff38e33177498",
                "sha256:a395b62d5f44ff6f633231abe568e2203b8fabf9797cd6386aa92497df912d9a",
                "sha256:a6d32c37f714c3f34158f3fa659f3a8f2658d5f53c4297d45579b9677cc4d852",
                "sha256:a89ee5c26f72f2d0d74b991ce49e42ddeb4ac0dc2d8c06a0f2770a1ab48f4fe0",
                "sha256:b4c8b0ef3608e59317bfc501df84a61e48b5445d45f24d0391a24802de5f2d84",
                "sha256:b5fcf07140219a1f71e18486b8dc28e2e1b76a441c19374805c617aa6d9a9d55",
                "sha256:b86f527f00956ecebad6ab3bb30e3a75fedf1160a8716978dd8ce7adddedd86f",
                "sha256:be4c4aa22ba22f70de36c98b06480e2f1697972d49eb20d525f400d204a6d272",
                "sha256:c2ac7aa1a144d4e0e613ac7286dae85671e99fe7a1353954d4905629c36b811c",
                "sha256:de26ef4787b5e778e8223913a3e50368b44e7480f83c76df1f51d23bd21cea16",
                "sha256:e70ebcfc5372dc7b699c0110454fc4263967f30c55454397e5769eb72c0eb0ce",
                "sha256:eadbd32b6bc48b67b0457fccc94c86f7ccc8178ab839f684eb285bb592dc143e",
                "sha256:ecbc6dfff6db06b8b72ae8a2f25ff20fbdcb83cb543811a08f7cb555042aa729"
            ],
            "index": "pypi",
            "version": "==2.7.5"
        }
    },
    "develop": {
        "atomicwrites": {
            "hashes": [
                "sha256:0312ad34fcad8fac3704d441f7b317e50af620823353ec657a53e981f92920c0",
                "sha256:ec9ae8adaae229e4f8446952d204a3e4b5fdd2d099f9be3aaf556120135fb3ee"
            ],
            "markers": "python_version != '3.1.*' and python_version >= '2.7' and python_version != '3.3.*' and python_version != '3.0.*' and python_version != '3.2.*'",
            "version": "==1.2.1"
        },
        "attrs": {
            "hashes": [
                "sha256:10cbf6e27dbce8c30807caf056c8eb50917e0eaafe86347671b57254006c3e69",
                "sha256:ca4be454458f9dec299268d472aaa5a11f67a4ff70093396e1ceae9c76cf4bbb"
            ],
            "version": "==18.2.0"
        },
        "boto3": {
            "hashes": [
                "sha256:0ed4b107c3b4550547aaec3c9bb17df068ff92d1f6f4781205800e2cb8a66de5",
                "sha256:64496f2c814e454e26c024df86bd08fb4643770d0e2b7a8fd70055fc6683eb9d"
            ],
            "index": "pypi",
            "version": "==1.7.84"
        },
        "botocore": {
            "hashes": [
                "sha256:380852e1adb9ba4ba9ff096af61f88a6888197b86e580e1bd786f04ebe6f9c0c",
                "sha256:d3e4b5a2c903ea30d19d41ea2f65d0e51dce54f4f4c4dfd6ecd7b04f240844a8"
            ],
            "version": "==1.10.84"
        },
        "coverage": {
            "hashes": [
                "sha256:03481e81d558d30d230bc12999e3edffe392d244349a90f4ef9b88425fac74ba",
                "sha256:0b136648de27201056c1869a6c0d4e23f464750fd9a9ba9750b8336a244429ed",
                "sha256:10a46017fef60e16694a30627319f38a2b9b52e90182dddb6e37dcdab0f4bf95",
                "sha256:198626739a79b09fa0a2f06e083ffd12eb55449b5f8bfdbeed1df4910b2ca640",
                "sha256:23d341cdd4a0371820eb2b0bd6b88f5003a7438bbedb33688cd33b8eae59affd",
                "sha256:28b2191e7283f4f3568962e373b47ef7f0392993bb6660d079c62bd50fe9d162",
                "sha256:2a5b73210bad5279ddb558d9a2bfedc7f4bf6ad7f3c988641d83c40293deaec1",
                "sha256:2eb564bbf7816a9d68dd3369a510be3327f1c618d2357fa6b1216994c2e3d508",
                "sha256:337ded681dd2ef9ca04ef5d93cfc87e52e09db2594c296b4a0a3662cb1b41249",
                "sha256:3a2184c6d797a125dca8367878d3b9a178b6fdd05fdc2d35d758c3006a1cd694",
                "sha256:3c79a6f7b95751cdebcd9037e4d06f8d5a9b60e4ed0cd231342aa8ad7124882a",
                "sha256:3d72c20bd105022d29b14a7d628462ebdc61de2f303322c0212a054352f3b287",
                "sha256:3eb42bf89a6be7deb64116dd1cc4b08171734d721e7a7e57ad64cc4ef29ed2f1",
                "sha256:4635a184d0bbe537aa185a34193898eee409332a8ccb27eea36f262566585000",
                "sha256:56e448f051a201c5ebbaa86a5efd0ca90d327204d8b059ab25ad0f35fbfd79f1",
                "sha256:5a13ea7911ff5e1796b6d5e4fbbf6952381a611209b736d48e675c2756f3f74e",
                "sha256:69bf008a06b76619d3c3f3b1983f5145c75a305a0fea513aca094cae5c40a8f5",
                "sha256:6bc583dc18d5979dc0f6cec26a8603129de0304d5ae1f17e57a12834e7235062",
                "sha256:701cd6093d63e6b8ad7009d8a92425428bc4d6e7ab8d75efbb665c806c1d79ba",
                "sha256:7608a3dd5d73cb06c531b8925e0ef8d3de31fed2544a7de6c63960a1e73ea4bc",
                "sha256:76ecd006d1d8f739430ec50cc872889af1f9c1b6b8f48e29941814b09b0fd3cc",
                "sha256:7aa36d2b844a3e4a4b356708d79fd2c260281a7390d678a10b91ca595ddc9e99",
                "sha256:7d3f553904b0c5c016d1dad058a7554c7ac4c91a789fca496e7d8347ad040653",
                "sha256:7e1fe19bd6dce69d9fd159d8e4a80a8f52101380d5d3a4d374b6d3eae0e5de9c",
                "sha256:8c3cb8c35ec4d9506979b4cf90ee9918bc2e49f84189d9bf5c36c0c1119c6558",
                "sha256:9d6dd10d49e01571bf6e147d3b505141ffc093a06756c60b053a859cb2128b1f",
                "sha256:be6cfcd8053d13f5f5eeb284aa8a814220c3da1b0078fa859011c7fffd86dab9",
                "sha256:c1bb572fab8208c400adaf06a8133ac0712179a334c09224fb11393e920abcdd",
                "sha256:de4418dadaa1c01d497e539210cb6baa015965526ff5afc078c57ca69160108d",
                "sha256:e05cb4d9aad6233d67e0541caa7e511fa4047ed7750ec2510d466e806e0255d6",
                "sha256:f3f501f345f24383c0000395b26b726e46758b71393267aeae0bd36f8b3ade80"
            ],
            "markers": "python_version != '3.1.*' and python_version < '4' and python_version != '3.0.*' and python_version != '3.2.*' and python_version >= '2.6'",
            "version": "==4.5.1"
        },
        "docutils": {
            "hashes": [
                "sha256:02aec4bd92ab067f6ff27a38a38a41173bf01bed8f89157768c1573f53e474a6",
                "sha256:51e64ef2ebfb29cae1faa133b3710143496eca21c530f3f71424d77687764274",
                "sha256:7a4bd47eaf6596e1295ecb11361139febe29b084a87bf005bf899f9a42edc3c6"
            ],
            "version": "==0.14"
        },
        "jmespath": {
            "hashes": [
                "sha256:6a81d4c9aa62caf061cb517b4d9ad1dd300374cd4706997aff9cd6aedd61fc64",
                "sha256:f11b4461f425740a1d908e9a3f7365c3d2e569f6ca68a2ff8bc5bcd9676edd63"
            ],
            "version": "==0.9.3"
        },
        "more-itertools": {
            "hashes": [
                "sha256:c187a73da93e7a8acc0001572aebc7e3c69daf7bf6881a2cea10650bd4420092",
                "sha256:c476b5d3a34e12d40130bc2f935028b5f636df8f372dc2c1c01dc19681b2039e",
                "sha256:fcbfeaea0be121980e15bc97b3817b5202ca73d0eae185b4550cbfce2a3ebb3d"
            ],
            "version": "==4.3.0"
        },
        "pluggy": {
            "hashes": [
                "sha256:6e3836e39f4d36ae72840833db137f7b7d35105079aee6ec4a62d9f80d594dd1",
                "sha256:95eb8364a4708392bae89035f45341871286a333f749c3141c20573d2b3876e1"
            ],
            "markers": "python_version != '3.1.*' and python_version >= '2.7' and python_version != '3.3.*' and python_version != '3.0.*' and python_version != '3.2.*'",
            "version": "==0.7.1"
        },
        "py": {
            "hashes": [
                "sha256:06a30435d058473046be836d3fc4f27167fd84c45b99704f2fb5509ef61f9af1",
                "sha256:50402e9d1c9005d759426988a492e0edaadb7f4e68bcddfea586bc7432d009c6"
            ],
            "markers": "python_version != '3.1.*' and python_version >= '2.7' and python_version != '3.3.*' and python_version != '3.0.*' and python_version != '3.2.*'",
            "version": "==1.6.0"
        },
        "pytest": {
            "hashes": [
                "sha256:7e258ee50338f4e46957f9e09a0f10fb1c2d05493fa901d113a8dafd0790de4e",
                "sha256:9332147e9af2dcf46cd7ceb14d5acadb6564744ddff1fe8c17f0ce60ece7d9a2"
            ],
            "index": "pypi",
            "version": "==3.8.2"
        },
        "pytest-cov": {
            "hashes": [
                "sha256:513c425e931a0344944f84ea47f3956be0e416d95acbd897a44970c8d926d5d7",
                "sha256:e360f048b7dae3f2f2a9a4d067b2dd6b6a015d384d1577c994a43f3f7cbad762"
            ],
            "index": "pypi",
            "version": "==2.6.0"
        },
        "pytest-env": {
            "hashes": [
                "sha256:7e94956aef7f2764f3c147d216ce066bf6c42948bb9e293169b1b1c880a580c2"
            ],
            "index": "pypi",
            "version": "==0.6.2"
        },
        "python-dateutil": {
            "hashes": [
                "sha256:1adb80e7a782c12e52ef9a8182bebeb73f1d7e24e374397af06fb4956c8dc5c0",
                "sha256:e27001de32f627c22380a688bcc43ce83504a7bc5da472209b4c70f02829f0b8"
            ],
            "markers": "python_version >= '2.7'",
            "version": "==2.7.3"
        },
        "s3transfer": {
            "hashes": [
                "sha256:90dc18e028989c609146e241ea153250be451e05ecc0c2832565231dacdf59c1",
                "sha256:c7a9ec356982d5e9ab2d4b46391a7d6a950e2b04c472419f5fdec70cc0ada72f"
            ],
            "version": "==0.1.13"
        },
        "six": {
            "hashes": [
                "sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9",
                "sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb"
            ],
            "version": "==1.11.0"
        },
        "urllib3": {
            "hashes": [
                "sha256:a68ac5e15e76e7e5dd2b8f94007233e01effe3e50e8daddf69acfd81cb686baf",
                "sha256:b5725a0bd4ba422ab0e66e89e030c806576753ea3ee08554382c14e685d117b5"
            ],
            "markers": "python_version != '3.1.*' and python_version < '4' and python_version != '3.3.*' and python_version != '3.0.*' and python_version != '3.2.*' and python_version >= '2.6'",
            "version": "==1.23"
        }
    }
}
@whren whren changed the title 2018.10.13 - pipenv clean under WSL raise a FileNotFoundError: [Errno 2] No such file or directory: '.../virtualenvs/env/include' pipenv clean - FileNotFoundError: [Errno 2] No such file or directory: '.../virtualenvs/env/include' Oct 17, 2018
@whren whren changed the title pipenv clean - FileNotFoundError: [Errno 2] No such file or directory: '.../virtualenvs/env/include' pipenv clean gives a FileNotFoundError: [Errno 2] No such file or directory: '.../virtualenvs/env/include' Oct 17, 2018
@whren whren changed the title pipenv clean gives a FileNotFoundError: [Errno 2] No such file or directory: '.../virtualenvs/env/include' pipenv clean gives a "FileNotFoundError: [Errno 2] No such file or directory: '.../virtualenvs/env/include'" Oct 17, 2018
@uranusjr uranusjr changed the title pipenv clean gives a "FileNotFoundError: [Errno 2] No such file or directory: '.../virtualenvs/env/include'" pipenv clean should ignore and skip entries if they don’t exist Oct 17, 2018
@uranusjr
Copy link
Member

@uranusjr uranusjr commented Oct 17, 2018

I modified the title a little to reflect the underlying problem (and how it should be fixed). Thanks for the report and sorry for the trouble.

@whren
Copy link
Author

@whren whren commented Oct 18, 2018

In addition, I have tried to workaround the issue creating an include empty folder, but I then faced the #3062

$ mkdir /home/xxx/.local/share/virtualenvs/create-service1-EZvUL_lY/include
$ pipenv clean

Traceback (most recent call last):
  File "/usr/local/bin/pipenv", line 11, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pipenv/cli/command.py", line 602, in clean
    do_clean(ctx=ctx, three=state.three, python=state.python, dry_run=dry_run)
  File "/usr/local/lib/python3.6/dist-packages/pipenv/core.py", line 2526, in do_clean
    canonicalize_name(pkg.project_name) for pkg in project.get_installed_packages()
  File "/usr/local/lib/python3.6/dist-packages/pipenv/project.py", line 320, in get_installed_packages
    packages = [pkg for pkg in workingset if self.dist_is_in_project(pkg)]
  File "/usr/local/lib/python3.6/dist-packages/pipenv/project.py", line 320, in <listcomp>
    packages = [pkg for pkg in workingset if self.dist_is_in_project(pkg)]
  File "/usr/local/lib/python3.6/dist-packages/pipenv/project.py", line 311, in dist_is_in_project
    prefix = _normalized(self.env_paths["prefix"])
  File "/usr/local/lib/python3.6/dist-packages/pipenv/project.py", line 951, in env_paths
    for k, v in sysconfig._INSTALL_SCHEMES[scheme].items()
  File "/usr/local/lib/python3.6/dist-packages/pipenv/project.py", line 951, in <dictcomp>
    for k, v in sysconfig._INSTALL_SCHEMES[scheme].items()
KeyError: 'py_version_short'
@CognexDaniel
Copy link
Contributor

@CognexDaniel CognexDaniel commented Oct 19, 2018

Hi @whren,

do you have the Python headers installed for the version of Python you're using in your virtual environment? I noticed that virtualenv (which I think pipenv uses to create the venv) will only create the include dir in the venv if they're installed.

I learned while investigating #3062 that pip clean needs not only for the include dir to exist, but also to contain the Python headers in a directory (or a symlink to a directory). virtualenv will create exactly that, but only if the headers are installed at the time you're creating the venv.

The funny thing is that I never would have noticed this on my Fedora install, because it installs the Python headers by default. But by chance I just noticed that Ubuntu doesn't, and so if I create a venv without installing them, I can reproduce your problem.

If I install python3-dev (or python-dev for Python 2.7) and recreate the venv, it's all good.

@whren
Copy link
Author

@whren whren commented Oct 20, 2018

Hi @CognexDaniel, very good catch ! I'm under ubuntu on WSL and did not have python 3.6 headers/static libraries installed.

I tried to install libpython3.6-dev and recreated a new virtualenv with a pipenv run pip install pip==18.0.
I confirm the include folder was created with a symlink to the headers files:

$ ls -lh /home/xxx/.local/share/virtualenvs/create-service1-EZvUL_lY/include/
total 0
lrwxrwxrwx 1 xxx xxx 23 oct.  20 11:03 python3.6m -> /usr/include/python3.6m

A pipenv clean does not raise the issue anymore.
So it may be a workaround to this isuse, at the moment, to force headers/static libraries installation.

techalchemy added a commit that referenced this issue Oct 30, 2018
- Fix inadvertent occasional global installation of files
- Fix inadvertent occcasional global removal of files
- Fix empty output from `pipenv update --outdated`
- Fixes #2828
- Fixes #3113
- Fixes #3047
- Fixes #3055

Signed-off-by: Dan Ryan <dan@danryan.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.