Virtualenv: Virtualenv 20.0.0b1 Fehler beim Erstellen von Venv für Brew Python2

Erstellt am 28. Jan. 2020  ·  10Kommentare  ·  Quelle: pypa/virtualenv

Auf meinem Mac mit Homebrew Python2 (und 3):

$ ls -al $(which python2)
lrwxr-xr-x  1 brettmz  admin  37 Nov 15 12:04 /usr/local/bin/python2 -> ../Cellar/python@2/2.7.17/bin/python2

Ich bekomme:

$ virtualenv --python /usr/local/bin/python2 py2env
Traceback (most recent call last):
  File "/Users/brettmz/Library/Python/3.7/bin/virtualenv", line 8, in <module>
    sys.exit(run())
  File "/Users/brettmz/Library/Python/3.7/lib/python/site-packages/virtualenv/__main__.py", line 16, in run
    run_via_cli(args)
  File "/Users/brettmz/Library/Python/3.7/lib/python/site-packages/virtualenv/run/__init__.py", line 21, in run_via_cli
    session = session_via_cli(args)
  File "/Users/brettmz/Library/Python/3.7/lib/python/site-packages/virtualenv/run/__init__.py", line 33, in session_via_cli
    raise RuntimeError("failed to find interpreter for {}".format(discover))
RuntimeError: failed to find interpreter for Builtin discover of python_spec='/usr/local/bin/python2'

Dies funktioniert ohne Fehler für aktuelle stabile virtualenv. Ist das beabsichtigt?

Hilfreichster Kommentar

Mit der unveränderten Beta funktioniert das:

virtualenv --python=/usr/local/bin/python2.7 foo

Beides funktioniert mit Ihrem aktuellen discovery Zweig.

Danke für deine schnelle Antwort.

Alle 10 Kommentare

@matthew-brett Ich muss bestätigen, danke, dass du mich darauf aufmerksam gemacht hast.

Hmmm, ich kann das nicht reproduzieren 🤔 kannst du die Ausgabe mit -vvv posten?

Sicher:

89 setup logging to NOTSET [DEBUG report:43]
161 find interpreter for spec PythonSpec(str_spec=/usr/local/bin/python2, path=/usr/local/bin/python2) [INFO builtin:44]
161 proposed PythonInfo(spec=CPython3.7.5.final.0-64, exe=/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7, platform=darwin, version='3.7.5 (v3.7.5:5c02a39a0b, Oct 14 2019, 19:07:34) \n[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]', encoding_fs_io=utf-8-UTF-8) [INFO builtin:48]
162 Attempting to acquire lock 4568075728 on /Users/brettmz/Library/Application Support/virtualenv/py-info/20.0.0b1/480187601bdac08cce463831e50aade5e1a71f4acabcd8828b0a0dd3276fab64.lock [DEBUG filelock:270]
162 Lock 4568075728 acquired on /Users/brettmz/Library/Application Support/virtualenv/py-info/20.0.0b1/480187601bdac08cce463831e50aade5e1a71f4acabcd8828b0a0dd3276fab64.lock [INFO filelock:274]
163 get PythonInfo from /Users/brettmz/Library/Application Support/virtualenv/py-info/20.0.0b1/480187601bdac08cce463831e50aade5e1a71f4acabcd8828b0a0dd3276fab64.json for /usr/local/bin/python2 [DEBUG cached_py_info:67]
163 Attempting to release lock 4568075728 on /Users/brettmz/Library/Application Support/virtualenv/py-info/20.0.0b1/480187601bdac08cce463831e50aade5e1a71f4acabcd8828b0a0dd3276fab64.lock [DEBUG filelock:315]
163 Lock 4568075728 released on /Users/brettmz/Library/Application Support/virtualenv/py-info/20.0.0b1/480187601bdac08cce463831e50aade5e1a71f4acabcd8828b0a0dd3276fab64.lock [INFO filelock:318]
163 proposed PythonInfo(spec=CPython2.7.17.final.0-64, exe=/usr/local/bin/python2.7, original=/usr/local/opt/python@2/bin/python2.7, platform=darwin, version='2.7.17 (default, Oct 24 2019, 12:57:38) \n[GCC 4.2.1 Compatible Apple LLVM 11.0.0 (clang-1100.0.33.8)]', encoding_fs_io=utf-8-None) [INFO builtin:48]
164 discover PATH[0]=/usr/local/opt/ruby/bin [DEBUG builtin:75]
164 discover PATH[1]=/Library/Frameworks/Python.framework/Versions/3.7/bin [DEBUG builtin:75]
164 discover PATH[2]=/Users/brettmz/usr/local/fsl/bin [DEBUG builtin:75]
165 discover PATH[3]=/Users/brettmz/Library/Python/3.7/bin [DEBUG builtin:75]
165 Attempting to acquire lock 4564090384 on /Users/brettmz/Library/Application Support/virtualenv/py-info/20.0.0b1/70b38d7a306a849643e446cd70466270a13445e5987dfa1344ef2b127438fa4d.lock [DEBUG filelock:270]
165 Lock 4564090384 acquired on /Users/brettmz/Library/Application Support/virtualenv/py-info/20.0.0b1/70b38d7a306a849643e446cd70466270a13445e5987dfa1344ef2b127438fa4d.lock [INFO filelock:274]
166 get PythonInfo from /Users/brettmz/Library/Application Support/virtualenv/py-info/20.0.0b1/70b38d7a306a849643e446cd70466270a13445e5987dfa1344ef2b127438fa4d.json for /Users/brettmz/Library/Python/3.7/bin/python [DEBUG cached_py_info:67]
166 Attempting to release lock 4564090384 on /Users/brettmz/Library/Application Support/virtualenv/py-info/20.0.0b1/70b38d7a306a849643e446cd70466270a13445e5987dfa1344ef2b127438fa4d.lock [DEBUG filelock:315]
166 Lock 4564090384 released on /Users/brettmz/Library/Application Support/virtualenv/py-info/20.0.0b1/70b38d7a306a849643e446cd70466270a13445e5987dfa1344ef2b127438fa4d.lock [INFO filelock:318]
166 proposed PythonInfo(spec=CPython3.7.5.final.0-64, exe=/Users/brettmz/Library/Python/3.7/bin/python, platform=darwin, version='3.7.5 (v3.7.5:5c02a39a0b, Oct 14 2019, 19:07:34) \n[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]', encoding_fs_io=utf-8-UTF-8) [INFO builtin:48]
167 discover PATH[4]=/usr/sbin [DEBUG builtin:75]
167 discover PATH[5]=/sbin [DEBUG builtin:75]
167 discover PATH[6]=/Users/brettmz/usr/bin [DEBUG builtin:75]
167 discover PATH[7]=/usr/local/bin [DEBUG builtin:75]
168 discover PATH[8]=/usr/bin [DEBUG builtin:75]
168 Attempting to acquire lock 4564099344 on /Users/brettmz/Library/Application Support/virtualenv/py-info/20.0.0b1/aaafe28a6254581d4f0ccfa0911e2de9e463b78fe3b32b118542e908e534a6ec.lock [DEBUG filelock:270]
168 Lock 4564099344 acquired on /Users/brettmz/Library/Application Support/virtualenv/py-info/20.0.0b1/aaafe28a6254581d4f0ccfa0911e2de9e463b78fe3b32b118542e908e534a6ec.lock [INFO filelock:274]
168 get PythonInfo from /Users/brettmz/Library/Application Support/virtualenv/py-info/20.0.0b1/aaafe28a6254581d4f0ccfa0911e2de9e463b78fe3b32b118542e908e534a6ec.json for /usr/bin/python [DEBUG cached_py_info:67]
169 Attempting to release lock 4564099344 on /Users/brettmz/Library/Application Support/virtualenv/py-info/20.0.0b1/aaafe28a6254581d4f0ccfa0911e2de9e463b78fe3b32b118542e908e534a6ec.lock [DEBUG filelock:315]
169 Lock 4564099344 released on /Users/brettmz/Library/Application Support/virtualenv/py-info/20.0.0b1/aaafe28a6254581d4f0ccfa0911e2de9e463b78fe3b32b118542e908e534a6ec.lock [INFO filelock:318]
169 proposed PythonInfo(spec=CPython2.7.16.final.0-64, exe=/usr/bin/python, original=/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python, platform=darwin, version='2.7.16 (default, Nov  9 2019, 05:55:08) \n[GCC 4.2.1 Compatible Apple LLVM 11.0.0 (clang-1100.0.32.4) (-macos10.15-objc-s', encoding_fs_io=utf-8-None) [INFO builtin:48]
169 discover PATH[9]=/bin [DEBUG builtin:75]
169 discover PATH[10]=/usr/sbin [DEBUG builtin:75]
169 discover PATH[11]=/sbin [DEBUG builtin:75]
170 discover PATH[12]=/Library/TeX/texbin [DEBUG builtin:75]
170 discover PATH[13]=/opt/X11/bin [DEBUG builtin:75]
170 done in 82ms [INFO __main__:23]
Traceback (most recent call last):
  File "/Users/brettmz/Library/Python/3.7/bin/virtualenv", line 8, in <module>
    sys.exit(run())
  File "/Users/brettmz/Library/Python/3.7/lib/python/site-packages/virtualenv/__main__.py", line 16, in run
    run_via_cli(args)
  File "/Users/brettmz/Library/Python/3.7/lib/python/site-packages/virtualenv/run/__init__.py", line 21, in run_via_cli
    session = session_via_cli(args)
  File "/Users/brettmz/Library/Python/3.7/lib/python/site-packages/virtualenv/run/__init__.py", line 33, in session_via_cli
    raise RuntimeError("failed to find interpreter for {}".format(discover))
RuntimeError: failed to find interpreter for Builtin discover of python_spec='/usr/local/bin/python2'

Dieser Teil scheint die relevanten Informationen zu sein:
```
161 find interpreter for spec PythonSpec(str_spec=/usr/local/bin/python2, path=/usr/local/bin/python2) [INFO builtin:44 ]

163 PythonInfo von /Users/brettmz/Library/Application Support/virtualenv/py-info/20.0.0b1/480187601bdac08cce463831e50aade5e1a71f4acabcd8828b0a0dd3276fab64.json für /usr/local/bin/python2_py-DEB erhalten :

163 vorgeschlagen PythonInfo (spez = CPython2.7.17.final.0-64, exe = / usr / local / bin / python2.7, original = / usr / local / opt / python@2/bin/python2.7 , Plattform = darwin, version='2.7.17 (Standard, 24. Oktober 2019, 12:57:38) \n[GCC 4.2.1 kompatibel Apple LLVM 11.0.0 (clang-1100.0.33.8)]', encoding_fs_io=utf-8- Keine) [INFO eingebaut:48 ]
````

Scheint irgendwie /usr/local/bin/python2 zu /usr/local/bin/python2.7 ... Was bedeutet /usr/local/bin/python2.7 auch?

Es gibt:

$ ls -al /usr/local/bin/python2.7
lrwxr-xr-x  1 brettmz  admin  39 Nov 15 12:04 /usr/local/bin/python2.7 -> ../Cellar/python@2/2.7.17/bin/python2.7

Das direkte Starten des Interpreters mit /usr/local/bin/python2 funktioniert in Ordnung, aber ich denke, das folgt aus der Tatsache, dass es von älteren virtualenv funktioniert.

$ /usr/local/bin/python2
Python 2.7.17 (default, Oct 24 2019, 12:57:38) 
[GCC 4.2.1 Compatible Apple LLVM 11.0.0 (clang-1100.0.33.8)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

Ich denke, https://github.com/pypa/virtualenv/pull/1513 wird dies beheben, wenn Sie es ausprobieren können 🤔

Um fair zu sein, wäre der richtige Test hier, zuerst eine Python mit /usr/local/bin/python2.7 und dann /usr/local/bin/python2 zu erstellen ... und beides sollte funktionieren.

Ich glaube, https://github.com/pypa/virtualenv/pull/1513 hat dies zumindest nach meinen Tests behoben. Wenn nicht, können Sie sich gerne zurückmelden und wir werden das Problem erneut öffnen.

Mit der unveränderten Beta funktioniert das:

virtualenv --python=/usr/local/bin/python2.7 foo

Beides funktioniert mit Ihrem aktuellen discovery Zweig.

Danke für deine schnelle Antwort.

Vielen Dank, dass Sie sich die Zeit genommen haben, die neue Version zu testen

thanks

War diese Seite hilfreich?
0 / 5 - 0 Bewertungen