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

python and python.app versions do not match #11633

Closed
cbrnr opened this issue Feb 28, 2020 · 5 comments
Closed

python and python.app versions do not match #11633

cbrnr opened this issue Feb 28, 2020 · 5 comments

Comments

@cbrnr
Copy link

cbrnr commented Feb 28, 2020

Actual Behavior

On macOS, we need to run Python scripts that access the window manager (GUIs created with e.g. wxPython, PyQt5, PySide2, ...) with pythonw instead of python (documented in #199 and #446, note that this is an Anaconda-specific solution because this is not required with the official Python binaries). The pythonw executable can be installed with the python.app package.

So this is what I'd do to install:

$ conda install python python.app

However, I was surprised to see that the Python versions in these executables don't match (here's the output for Python 3.7 as currently found in the default channel):

$ python -V
Python 3.7.6
$ pythonw -V
Python 3.7.0

This is not just a cosmetic issue, but may cause problems with multiprocessing. Using Python 3.7, the following script (saved as mwe.py) runs fine with python, but crashes with a segfault with pythonw:

import multiprocessing
import time


def f():
    print('Executing f()...')


if __name__ == '__main__':
    pool = multiprocessing.Pool()
    pool.apply_async(func=f)

    time.sleep(1)

    pool.terminate()
    pool.join()

So python mwe.py runs without issues, but pythonw mwe.py results in /Users/clemens/anaconda/bin/pythonw: line 3: 1767 Segmentation fault: 11 /Users/clemens/anaconda/python.app/Contents/MacOS/python "$@".

Interestingly, even though the versions don't match for Python 3.6 and Python 3.8 either (I didn't test older versions), this script does work even with pythonw.

Expected Behavior

Python versions for python and python.app (started as pythonw) should match.

Anaconda or Miniconda version:

This problem exists with several versions, the current version 3.7 has the following Python versions:

$ python -V
Python 3.7.6
$ pythonw -V
Python 3.7.0

But conda create -n python=3.8 python.app also has different versions:

$ python -V
Python 3.8.1
$ pythonw -V
Python 3.8.0

Same for conda create -n python=3.6 python.app:

$ python -V
Python 3.6.10 :: Anaconda, Inc.
$ pythonw -V
Python 3.6.6 :: Anaconda, Inc.
Operating System:

macOS 10.15.3

conda info
     active environment : base
    active env location : /Users/clemens/anaconda
            shell level : 1
       user config file : /Users/clemens/.condarc
 populated config files : /Users/clemens/.condarc
          conda version : 4.8.2
    conda-build version : not installed
         python version : 3.7.6.final.0
       virtual packages : __osx=10.15.3
       base environment : /Users/clemens/anaconda  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /Users/clemens/anaconda/pkgs
                          /Users/clemens/.conda/pkgs
       envs directories : /Users/clemens/anaconda/envs
                          /Users/clemens/.conda/envs
               platform : osx-64
             user-agent : conda/4.8.2 requests/2.22.0 CPython/3.7.6 Darwin/19.3.0 OSX/10.15.3
                UID:GID : 501:20
             netrc file : None
           offline mode : False
conda list --show-channel-urls
# packages in environment at /Users/clemens/anaconda:
#
# Name                    Version                   Build  Channel
asn1crypto                1.3.0                    py37_0    defaults
blas                      1.0                         mkl    defaults
ca-certificates           2020.1.1                      0    defaults
certifi                   2019.11.28               py37_0    defaults
cffi                      1.14.0           py37hb5b8e2f_0    defaults
chardet                   3.0.4                 py37_1003    defaults
conda                     4.8.2                    py37_0    defaults
conda-package-handling    1.6.0            py37h1de35cc_0    defaults
cryptography              2.8              py37ha12b0ac_0    defaults
cycler                    0.10.0                   py37_0    defaults
freetype                  2.9.1                hb4e5f40_0    defaults
idna                      2.8                      py37_0    defaults
intel-openmp              2019.4                      233    defaults
kiwisolver                1.1.0            py37h0a44026_0    defaults
libcxx                    4.0.1                hcfea43d_1    defaults
libcxxabi                 4.0.1                hcfea43d_1    defaults
libedit                   3.1.20181209         hb402a30_0    defaults
libffi                    3.2.1                h475c297_4    defaults
libgfortran               3.0.1                h93005f0_2    defaults
libpng                    1.6.37               ha441bb4_0    defaults
matplotlib                3.1.3                    py37_0    defaults
matplotlib-base           3.1.3            py37h9aa3819_0    defaults
mkl                       2019.4                      233    defaults
mkl-service               2.3.0            py37hfbe908c_0    defaults
mkl_fft                   1.0.15           py37h5e564d8_0    defaults
mkl_random                1.1.0            py37ha771720_0    defaults
mne                       0.19.2                   pypi_0    pypi
ncurses                   6.2                  h0a44026_0    defaults
numpy                     1.18.1           py37h7241aed_0    defaults
numpy-base                1.18.1           py37h6575580_1    defaults
openssl                   1.1.1d               h1de35cc_4    defaults
pip                       20.0.2                   py37_1    defaults
pycosat                   0.6.3            py37h1de35cc_0    defaults
pycparser                 2.19                     py37_0    defaults
pyopenssl                 19.1.0                   py37_0    defaults
pyparsing                 2.4.6                      py_0    defaults
pysocks                   1.7.1                    py37_0    defaults
python                    3.7.6                h359304d_2    defaults
python-dateutil           2.8.1                      py_0    defaults
python.app                2                        py37_9    defaults
readline                  7.0                  h1de35cc_5    defaults
requests                  2.22.0                   py37_1    defaults
ruamel_yaml               0.15.87          py37h1de35cc_0    defaults
scipy                     1.4.1            py37h9fa6033_0    defaults
setuptools                45.2.0                   py37_0    defaults
six                       1.14.0                   py37_0    defaults
sqlite                    3.31.1               ha441bb4_0    defaults
tk                        8.6.8                ha441bb4_0    defaults
tornado                   6.0.3            py37h1de35cc_3    defaults
tqdm                      4.42.1                     py_0    defaults
urllib3                   1.25.8                   py37_0    defaults
wheel                     0.34.2                   py37_0    defaults
xz                        5.2.4                h1de35cc_4    defaults
yaml                      0.1.7                hc338f04_2    defaults
zlib                      1.2.11               h1de35cc_3    defaults
@cbrnr
Copy link
Author

cbrnr commented Feb 28, 2020

I forgot to mention that the non-matching versions is indeed causing the example script to segfault. If I remove the python executable in anaconda/python.app/Contents/MacOS and replaced it with a symbolic link to the normal anaconda/bin/python the script works!

@cbrnr
Copy link
Author

cbrnr commented Feb 28, 2020

So ideally, the python.app package should just contain a symlink to the original python executable if this is supported by conda (no idea). That way, the versions would match automatically.

@forrestwaters
Copy link

There is a new version of python.app available with the latest python version. Sorry for the confusing behavior.

@cbrnr
Copy link
Author

cbrnr commented Mar 4, 2020

Would it be possible to sync the versions also at least for Python 3.7? This is still the default version in Anaconda.

@cbrnr
Copy link
Author

cbrnr commented Mar 5, 2020

I just noticed that the python.app package was updated for 3.6, 3.7, and 3.8 so this problem is fixed. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants