virtualenv: conda commands as Python3 subprocesses inside a virtualenv fail under macOS

Issue

Describe what’s the expected behaviour and what you’re observing.

Running any conda command as a Python3 subprocess inside of a virtualenv fails under macOS with ModuleNotFoundError: No module named 'conda'. This works fine under Linux or when using Python2 or virtualenv <20. The same works fine also before activating and after deactivating the virtualenv.

Tested on the latest virtualenv 20.0.9.

See https://travis-ci.org/nsoranzo/bioblend/builds/660456892 for how to reproduce on TravisCI and example of success and failure of the same commands under Linux and macOS respectively.

Environment

Provide at least:

  • OS: macOS

  • pip list of the host python where virtualenv is installed:

    Package    Version
    ---------- -------
    GDAL       2.4.2  
    mercurial  5.2    
    numpy      1.17.4 
    pip        19.3.1 
    protobuf   3.11.1 
    setuptools 41.6.0 
    six        1.13.0 
    wheel      0.33.6 
    

Output of the virtual environment creation

Make sure to run the creation with -vvv --with-traceback:

152 setup logging to NOTSET [DEBUG report:43]
152 created app data folder /Users/travis/Library/Application Support/virtualenv [DEBUG app_data:52]
165 find interpreter for spec PythonSpec(implementation=CPython, major=3) [INFO builtin:44]
166 proposed PythonInfo(spec=CPython3.7.5.final.0-64, exe=/usr/local/opt/python/bin/python3.7, platform=darwin, version='3.7.5 (default, Nov  1 2019, 02:16:38) \n[Clang 10.0.0 (clang-1000.11.45.5)]', encoding_fs_io=utf-8-UTF-8) [INFO builtin:50]
166 accepted PythonInfo(spec=CPython3.7.5.final.0-64, exe=/usr/local/opt/python/bin/python3.7, platform=darwin, version='3.7.5 (default, Nov  1 2019, 02:16:38) \n[Clang 10.0.0 (clang-1000.11.45.5)]', encoding_fs_io=utf-8-UTF-8) [DEBUG builtin:52]
173 filesystem is not case-sensitive [DEBUG info:28]
278 create virtual environment via CPython3Posix(dest=/Users/travis/build/nsoranzo/bioblend/.venv, clear=False, global=False) [INFO session:52]
278 create folder /Users/travis/build/nsoranzo/bioblend/.venv/bin [DEBUG _sync:21]
278 create folder /Users/travis/build/nsoranzo/bioblend/.venv/lib/python3.7/site-packages [DEBUG _sync:21]
279 write /Users/travis/build/nsoranzo/bioblend/.venv/pyvenv.cfg [DEBUG pyenv_cfg:34]
279 	home = /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7 [DEBUG pyenv_cfg:38]
279 	implementation = CPython [DEBUG pyenv_cfg:38]
279 	version_info = 3.7.5.final.0 [DEBUG pyenv_cfg:38]
279 	virtualenv = 20.0.9 [DEBUG pyenv_cfg:38]
280 	include-system-site-packages = false [DEBUG pyenv_cfg:38]
280 	base-prefix = /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7 [DEBUG pyenv_cfg:38]
280 	base-exec-prefix = /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7 [DEBUG pyenv_cfg:38]
280 	base-executable = /usr/local/opt/python/bin/python3.7 [DEBUG pyenv_cfg:38]
280 symlink /usr/local/opt/python/bin/python3.7 to /Users/travis/build/nsoranzo/bioblend/.venv/bin/python [DEBUG _sync:40]
282 create /Users/travis/build/nsoranzo/bioblend/.venv/lib/python3.7/site-packages/_virtualenv.py [DEBUG api:60]
283 create virtualenv import hook file /Users/travis/build/nsoranzo/bioblend/.venv/lib/python3.7/site-packages/_virtualenv.pth [DEBUG api:63]
283 ============================== target debug ============================== [DEBUG session:54]
284 debug via /Users/travis/build/nsoranzo/bioblend/.venv/bin/python /usr/local/lib/python3.7/site-packages/virtualenv/create/debug.py [DEBUG creator:182]
283 {
  "sys": {
    "executable": "/Users/travis/build/nsoranzo/bioblend/.venv/bin/python",
    "_base_executable": "/Users/travis/build/nsoranzo/bioblend/.venv/bin/python",
    "prefix": "/Users/travis/build/nsoranzo/bioblend/.venv",
    "base_prefix": "/usr/local/opt/python/bin/../Frameworks/Python.framework/Versions/3.7",
    "real_prefix": null,
    "exec_prefix": "/Users/travis/build/nsoranzo/bioblend/.venv",
    "base_exec_prefix": "/usr/local/opt/python/bin/../Frameworks/Python.framework/Versions/3.7",
    "path": [
      "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python37.zip",
      "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7",
      "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload",
      "/Users/travis/build/nsoranzo/bioblend/.venv/lib/python3.7/site-packages"
    ],
    "meta_path": [
      "<class '_virtualenv._Finder'>",
      "<class '_frozen_importlib.BuiltinImporter'>",
      "<class '_frozen_importlib.FrozenImporter'>",
      "<class '_frozen_importlib_external.PathFinder'>"
    ],
    "fs_encoding": "utf-8",
    "io_encoding": "UTF-8"
  },
  "version": "3.7.5 (default, Nov  1 2019, 02:16:38) \n[Clang 10.0.0 (clang-1000.11.45.5)]",
  "os": "<module 'os' from '/usr/local/opt/python/bin/../Frameworks/Python.framework/Versions/3.7/lib/python3.7/os.py'>",
  "site": "<module 'site' from '/usr/local/opt/python/bin/../Frameworks/Python.framework/Versions/3.7/lib/python3.7/site.py'>",
  "datetime": "<module 'datetime' from '/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/datetime.py'>",
  "math": "<module 'math' from '/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/math.cpython-37m-darwin.so'>",
  "json": "<module 'json' from '/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/__init__.py'>"
} [DEBUG session:55]
354 add seed packages via FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, via=copy, app_data_dir=/Users/travis/Library/Application Support/virtualenv/seed-app-data/v1) [INFO session:59]
355 Attempting to acquire lock 4344232784 on /Users/travis/Library/Application Support/virtualenv/seed-app-data/v1/3.7/wheels.lock [DEBUG filelock:270]
356 Lock 4344232784 acquired on /Users/travis/Library/Application Support/virtualenv/seed-app-data/v1/3.7/wheels.lock [INFO filelock:274]
357 get bundled wheel /usr/local/lib/python3.7/site-packages/virtualenv/seed/embed/wheels/pip-20.0.2-py2.py3-none-any.whl [DEBUG acquire:51]
357 get bundled wheel /usr/local/lib/python3.7/site-packages/virtualenv/seed/embed/wheels/setuptools-45.3.0-py3-none-any.whl [DEBUG acquire:51]
358 get bundled wheel /usr/local/lib/python3.7/site-packages/virtualenv/seed/embed/wheels/wheel-0.34.2-py2.py3-none-any.whl [DEBUG acquire:51]
373 install wheel from wheel /Users/travis/Library/Application Support/virtualenv/seed-app-data/v1/3.7/wheels/wheel-0.34.2-py2.py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:46]
373 build install image to /Users/travis/Library/Application Support/virtualenv/seed-app-data/v1/3.7/image/CopyPipInstall/wheel-0.34.2-py2.py3-none-any of wheel-0.34.2-py2.py3-none-any.whl [DEBUG base:57]
374 install setuptools from wheel /Users/travis/Library/Application Support/virtualenv/seed-app-data/v1/3.7/wheels/setuptools-45.3.0-py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:46]
375 build install image to /Users/travis/Library/Application Support/virtualenv/seed-app-data/v1/3.7/image/CopyPipInstall/setuptools-45.3.0-py3-none-any of setuptools-45.3.0-py3-none-any.whl [DEBUG base:57]
375 install pip from wheel /Users/travis/Library/Application Support/virtualenv/seed-app-data/v1/3.7/wheels/pip-20.0.2-py2.py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:46]
376 build install image to /Users/travis/Library/Application Support/virtualenv/seed-app-data/v1/3.7/image/CopyPipInstall/pip-20.0.2-py2.py3-none-any of pip-20.0.2-py2.py3-none-any.whl [DEBUG base:57]
418 changing mode of /var/folders/nz/vv4_9tw56nv9k3tkvyszvwg80000gn/T/tmp4niwmfd9/wheel-3.7 to 755 [INFO util:566]
419 changing mode of /var/folders/nz/vv4_9tw56nv9k3tkvyszvwg80000gn/T/tmp4niwmfd9/wheel to 755 [INFO util:566]
421 changing mode of /var/folders/nz/vv4_9tw56nv9k3tkvyszvwg80000gn/T/tmp4niwmfd9/wheel3 to 755 [INFO util:566]
432 copy directory /Users/travis/Library/Application Support/virtualenv/seed-app-data/v1/3.7/image/CopyPipInstall/wheel-0.34.2-py2.py3-none-any/wheel to /Users/travis/build/nsoranzo/bioblend/.venv/lib/python3.7/site-packages/wheel [DEBUG _sync:48]
466 copy directory /Users/travis/Library/Application Support/virtualenv/seed-app-data/v1/3.7/image/CopyPipInstall/wheel-0.34.2-py2.py3-none-any/wheel-0.34.2.dist-info to /Users/travis/build/nsoranzo/bioblend/.venv/lib/python3.7/site-packages/wheel-0.34.2.dist-info [DEBUG _sync:48]
474 copy /Users/travis/Library/Application Support/virtualenv/seed-app-data/v1/3.7/image/CopyPipInstall/wheel-0.34.2-py2.py3-none-any/wheel-0.34.2.virtualenv to /Users/travis/build/nsoranzo/bioblend/.venv/lib/python3.7/site-packages/wheel-0.34.2.virtualenv [DEBUG _sync:48]
475 changing mode of /Users/travis/build/nsoranzo/bioblend/.venv/bin/wheel-3.7 to 755 [INFO util:566]
475 changing mode of /Users/travis/build/nsoranzo/bioblend/.venv/bin/wheel to 755 [INFO util:566]
476 changing mode of /Users/travis/build/nsoranzo/bioblend/.venv/bin/wheel3 to 755 [INFO util:566]
476 generated console scripts wheel3 wheel-3.7 wheel [DEBUG base:53]
542 changing mode of /var/folders/nz/vv4_9tw56nv9k3tkvyszvwg80000gn/T/tmpdfedv6sv/easy_install to 755 [INFO util:566]
543 changing mode of /var/folders/nz/vv4_9tw56nv9k3tkvyszvwg80000gn/T/tmpdfedv6sv/easy_install3 to 755 [INFO util:566]
544 changing mode of /var/folders/nz/vv4_9tw56nv9k3tkvyszvwg80000gn/T/tmpdfedv6sv/easy_install-3.7 to 755 [INFO util:566]
563 copy /Users/travis/Library/Application Support/virtualenv/seed-app-data/v1/3.7/image/CopyPipInstall/setuptools-45.3.0-py3-none-any/easy_install.py to /Users/travis/build/nsoranzo/bioblend/.venv/lib/python3.7/site-packages/easy_install.py [DEBUG _sync:48]
564 copy directory /Users/travis/Library/Application Support/virtualenv/seed-app-data/v1/3.7/image/CopyPipInstall/setuptools-45.3.0-py3-none-any/pkg_resources to /Users/travis/build/nsoranzo/bioblend/.venv/lib/python3.7/site-packages/pkg_resources [DEBUG _sync:48]
584 copy directory /Users/travis/Library/Application Support/virtualenv/seed-app-data/v1/3.7/image/CopyPipInstall/setuptools-45.3.0-py3-none-any/setuptools to /Users/travis/build/nsoranzo/bioblend/.venv/lib/python3.7/site-packages/setuptools [DEBUG _sync:48]
655 copy directory /Users/travis/Library/Application Support/virtualenv/seed-app-data/v1/3.7/image/CopyPipInstall/setuptools-45.3.0-py3-none-any/setuptools-45.3.0.dist-info to /Users/travis/build/nsoranzo/bioblend/.venv/lib/python3.7/site-packages/setuptools-45.3.0.dist-info [DEBUG _sync:48]
667 copy /Users/travis/Library/Application Support/virtualenv/seed-app-data/v1/3.7/image/CopyPipInstall/setuptools-45.3.0-py3-none-any/setuptools-45.3.0.virtualenv to /Users/travis/build/nsoranzo/bioblend/.venv/lib/python3.7/site-packages/setuptools-45.3.0.virtualenv [DEBUG _sync:48]
668 changing mode of /Users/travis/build/nsoranzo/bioblend/.venv/bin/easy_install to 755 [INFO util:566]
669 changing mode of /Users/travis/build/nsoranzo/bioblend/.venv/bin/easy_install3 to 755 [INFO util:566]
670 changing mode of /Users/travis/build/nsoranzo/bioblend/.venv/bin/easy_install-3.7 to 755 [INFO util:566]
671 generated console scripts easy_install3 easy_install-3.7 easy_install [DEBUG base:53]
746 changing mode of /var/folders/nz/vv4_9tw56nv9k3tkvyszvwg80000gn/T/tmp9zqbno9l/pip to 755 [INFO util:566]
746 changing mode of /var/folders/nz/vv4_9tw56nv9k3tkvyszvwg80000gn/T/tmp9zqbno9l/pip3 to 755 [INFO util:566]
747 changing mode of /var/folders/nz/vv4_9tw56nv9k3tkvyszvwg80000gn/T/tmp9zqbno9l/pip-3.7 to 755 [INFO util:566]
781 copy directory /Users/travis/Library/Application Support/virtualenv/seed-app-data/v1/3.7/image/CopyPipInstall/pip-20.0.2-py2.py3-none-any/pip to /Users/travis/build/nsoranzo/bioblend/.venv/lib/python3.7/site-packages/pip [DEBUG _sync:48]
969 copy directory /Users/travis/Library/Application Support/virtualenv/seed-app-data/v1/3.7/image/CopyPipInstall/pip-20.0.2-py2.py3-none-any/pip-20.0.2.dist-info to /Users/travis/build/nsoranzo/bioblend/.venv/lib/python3.7/site-packages/pip-20.0.2.dist-info [DEBUG _sync:48]
972 copy /Users/travis/Library/Application Support/virtualenv/seed-app-data/v1/3.7/image/CopyPipInstall/pip-20.0.2-py2.py3-none-any/pip-20.0.2.virtualenv to /Users/travis/build/nsoranzo/bioblend/.venv/lib/python3.7/site-packages/pip-20.0.2.virtualenv [DEBUG _sync:48]
973 changing mode of /Users/travis/build/nsoranzo/bioblend/.venv/bin/pip to 755 [INFO util:566]
974 changing mode of /Users/travis/build/nsoranzo/bioblend/.venv/bin/pip3 to 755 [INFO util:566]
975 changing mode of /Users/travis/build/nsoranzo/bioblend/.venv/bin/pip-3.7 to 755 [INFO util:566]
975 generated console scripts pip3 pip pip-3.7 [DEBUG base:53]
975 Attempting to release lock 4344232784 on /Users/travis/Library/Application Support/virtualenv/seed-app-data/v1/3.7/wheels.lock [DEBUG filelock:315]
975 Lock 4344232784 released on /Users/travis/Library/Application Support/virtualenv/seed-app-data/v1/3.7/wheels.lock [INFO filelock:318]
976 add activators for Bash, CShell, Fish, PowerShell, Python, Xonsh [INFO session:65]
980 write /Users/travis/build/nsoranzo/bioblend/.venv/pyvenv.cfg [DEBUG pyenv_cfg:34]
980 	home = /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7 [DEBUG pyenv_cfg:38]
980 	implementation = CPython [DEBUG pyenv_cfg:38]
981 	version_info = 3.7.5.final.0 [DEBUG pyenv_cfg:38]
981 	virtualenv = 20.0.9 [DEBUG pyenv_cfg:38]
981 	include-system-site-packages = false [DEBUG pyenv_cfg:38]
981 	base-prefix = /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7 [DEBUG pyenv_cfg:38]
981 	base-exec-prefix = /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7 [DEBUG pyenv_cfg:38]
982 	base-executable = /usr/local/opt/python/bin/python3.7 [DEBUG pyenv_cfg:38]
982 created virtual environment CPython3.7.5.final.0-64 in 833ms
  creator CPython3Posix(dest=/Users/travis/build/nsoranzo/bioblend/.venv, clear=False, global=False)
  seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, via=copy, app_data_dir=/Users/travis/Library/Application Support/virtualenv/seed-app-data/v1)
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator [WARNING __main__:21]

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (15 by maintainers)

Most upvoted comments

Yeah needs to go on bugs.python.org; have a feeling this could be related to https://github.com/python/cpython/pull/9516 🤷‍♂