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

Add entry point for python3 command #349

Open
hmaarrfk opened this issue May 26, 2020 · 13 comments · May be fixed by #640
Open

Add entry point for python3 command #349

hmaarrfk opened this issue May 26, 2020 · 13 comments · May be fixed by #640

Comments

@hmaarrfk
Copy link

Issue:

On ubuntu, there is an entry point for both python3 and python3.

On windows, python3 doesn't exist.

Not sure about osx.

Could windows be added an entry point for the command python3 so that we can reach a broader audiance with "fool proof" instructions.

Ubuntu
image

Windows: (I deleted things in my roaming path between the two commands)
image


Environment (conda list):
$ conda list
# packages in environment at C:\Users\mark\miniconda3:
#
# Name                    Version                   Build  Channel
anaconda-client           1.7.2                      py_0    conda-forge
attrs                     19.3.0                     py_0    conda-forge
beautifulsoup4            4.9.1            py37hc8dfbb8_0    conda-forge
blinker                   1.4                        py_1    conda-forge
boolean.py                3.7                        py_0    conda-forge
brotlipy                  0.7.0           py37h4ab8f01_1000    conda-forge
bzip2                     1.0.8                hfa6e2cd_2    conda-forge
ca-certificates           2020.4.5.1           hecc5488_0    conda-forge
certifi                   2020.4.5.1       py37hc8dfbb8_0    conda-forge
cffi                      1.14.0           py37ha419a9e_0    conda-forge
chardet                   3.0.4           py37hc8dfbb8_1006    conda-forge
clyent                    1.2.2                      py_1    conda-forge
conda                     4.8.3            py37hc8dfbb8_1    conda-forge
conda-build               3.19.2           py37hc8dfbb8_2    conda-forge
conda-forge-pinning       2020.05.25.23.01.15               0    conda-forge
conda-package-handling    1.6.0            py37h702c6c1_2    conda-forge
conda-smithy              3.7.3                      py_0    conda-forge
console_shortcut          0.1.1                         4
cryptography              2.9.2            py37h26f1ce3_0    conda-forge
decorator                 4.4.2                      py_0    conda-forge
deprecated                1.2.10             pyh9f0ad1d_0    conda-forge
filelock                  3.0.12             pyh9f0ad1d_0    conda-forge
git                       2.26.2                        0    conda-forge
gitdb                     4.0.5                      py_0    conda-forge
gitpython                 3.1.2                      py_0    conda-forge
glob2                     0.7                        py_0    conda-forge
idna                      2.9                        py_1    conda-forge
importlib-metadata        1.6.0            py37hc8dfbb8_0    conda-forge
importlib_metadata        1.6.0                         0    conda-forge
ipython_genutils          0.2.0                      py_1    conda-forge
isodate                   0.6.0                      py_1    conda-forge
jinja2                    2.11.2             pyh9f0ad1d_0    conda-forge
jsonschema                3.2.0            py37hc8dfbb8_1    conda-forge
jupyter_core              4.6.3            py37hc8dfbb8_1    conda-forge
krb5                      1.17.1               hdd46e55_0    conda-forge
libarchive                3.3.3             h0c0e0cf_1008    conda-forge
libcurl                   7.69.1               h1dcc11c_0    conda-forge
libiconv                  1.15              hfa6e2cd_1006    conda-forge
liblief                   0.10.1               ha925a31_0
libsolv                   0.7.13               h7bd577a_3    conda-forge
libssh2                   1.9.0                h3235a2c_2    conda-forge
libxml2                   2.9.10               h5d81f1c_1    conda-forge
license-expression        1.2                        py_0    conda-forge
lz4-c                     1.9.2                h62dcd97_1    conda-forge
lzo                       2.10              hfa6e2cd_1000    conda-forge
m2-msys2-runtime          2.5.0.17080.65c939c               3
m2-patch                  2.7.5                         2
m2w64-gcc-libgfortran     5.3.0                         6
m2w64-gcc-libs            5.3.0                         7
m2w64-gcc-libs-core       5.3.0                         7
m2w64-gmp                 6.1.0                         2
m2w64-libwinpthread-git   5.0.0.4634.697f757               2
mamba                     0.2.12           py37h9da7104_0    conda-forge
markupsafe                1.1.1            py37h8055547_1    conda-forge
menuinst                  1.4.16                   py37_0    conda-forge
msrest                    0.6.10                     py_0    conda-forge
msys2-conda-epoch         20160418                      1
nbformat                  5.0.6                      py_0    conda-forge
oauthlib                  3.0.1                      py_0    conda-forge
openssl                   1.1.1g               he774522_0    conda-forge
pip                       20.1.1             pyh9f0ad1d_0    conda-forge
pkginfo                   1.5.0.1                    py_0    conda-forge
powershell_shortcut       0.0.1                         3
psutil                    5.7.0            py37h8055547_1    conda-forge
py-lief                   0.10.1           py37ha925a31_0
pycosat                   0.6.3           py37h8055547_1004    conda-forge
pycparser                 2.20                       py_0    conda-forge
pycrypto                  2.6.1           py37h8055547_1004    conda-forge
pygithub                  1.51                       py_0    conda-forge
pyjwt                     1.7.1                      py_0    conda-forge
pyopenssl                 19.1.0                     py_1    conda-forge
pyrsistent                0.16.0           py37h8055547_0    conda-forge
pysocks                   1.7.1            py37hc8dfbb8_1    conda-forge
python                    3.7.6           h60c2a47_5_cpython    conda-forge
python-dateutil           2.8.1                      py_0    conda-forge
python-libarchive-c       2.9                      py37_0    conda-forge
python_abi                3.7                     1_cp37m    conda-forge
pytz                      2020.1             pyh9f0ad1d_0    conda-forge
pywin32                   227              py37hfa6e2cd_0    conda-forge
pyyaml                    5.3.1            py37h8055547_0    conda-forge
requests                  2.23.0             pyh8c360ce_2    conda-forge
requests-oauthlib         1.2.0                      py_0    conda-forge
ripgrep                   12.1.0               h301d43c_0    conda-forge
ruamel.yaml               0.16.6           py37h8055547_1    conda-forge
ruamel.yaml.clib          0.2.0            py37h8055547_1    conda-forge
ruamel_yaml               0.15.80         py37h8055547_1001    conda-forge
scrypt                    0.8.15           py37h90766aa_0    conda-forge
setuptools                46.4.0           py37hc8dfbb8_0    conda-forge
six                       1.15.0             pyh9f0ad1d_0    conda-forge
smmap                     3.0.4              pyh9f0ad1d_0    conda-forge
soupsieve                 2.0.1            py37hc8dfbb8_0    conda-forge
sqlite                    3.30.1               hfa6e2cd_0    conda-forge
tk                        8.6.10               hfa6e2cd_0    conda-forge
toolz                     0.10.0                     py_0    conda-forge
tqdm                      4.46.0             pyh9f0ad1d_0    conda-forge
traitlets                 4.3.3            py37hc8dfbb8_1    conda-forge
urllib3                   1.25.9                     py_0    conda-forge
vc                        14.1                 h869be7e_1    conda-forge
vs2015_runtime            14.16.27012          h30e32a0_2    conda-forge
vsts-python-api           0.1.22                     py_0    conda-forge
wheel                     0.34.2                     py_1    conda-forge
win_inet_pton             1.1.0                    py37_0    conda-forge
wincertstore              0.2                   py37_1003    conda-forge
wrapt                     1.12.1           py37h8055547_1    conda-forge
xz                        5.2.5                h2fa13f4_0    conda-forge
yaml                      0.2.4                he774522_0    conda-forge
zipp                      3.1.0                      py_0    conda-forge
zlib                      1.2.11            h2fa13f4_1006    conda-forge
zstd                      1.4.4                h9f78265_3    conda-forge

Details about conda and system ( conda info ):
(base) C:\Users\mark>conda info

     active environment : base
    active env location : C:\Users\mark\miniconda3
            shell level : 1
       user config file : C:\Users\mark\.condarc
 populated config files : C:\Users\mark\.condarc
          conda version : 4.8.3
    conda-build version : 3.19.2
         python version : 3.7.6.final.0
       virtual packages : __cuda=10.1
       base environment : C:\Users\mark\miniconda3  (writable)
           channel URLs : https://conda.anaconda.org/ramonaoptics/win-64
                          https://conda.anaconda.org/ramonaoptics/noarch
                          https://conda.anaconda.org/conda-forge/win-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\Users\mark\miniconda3\pkgs
                          C:\Users\mark\.conda\pkgs
                          C:\Users\mark\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\mark\miniconda3\envs
                          C:\Users\mark\.conda\envs
                          C:\Users\mark\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.8.3 requests/2.23.0 CPython/3.7.6 Windows/10 Windows/10.0.18362
          administrator : False
             netrc file : None
           offline mode : False
@hmaarrfk
Copy link
Author

@conda-forge/core any thoughts on this?

We were able to move a pip3 package through, but I know this one may be a little more contentious.

@isuruf
Copy link
Member

isuruf commented May 31, 2020

How do you propose we build a python3.exe? copy python.exe to python3.exe? That's a waste of space.

@hmaarrfk
Copy link
Author

Actually, I hadn't thought of that, and that sounds like a great easy idea!!!

100kB copy seems well worth it to me.

image

image

Detailed motivation

In the cross referenced issue, I'm trying to get people going with scikit-image as fast as possible, and unfortunately, I am forced to prefix instructions with:

**Finding your python command**

To install ``scikit-image`` with `pip <https://pip.pypa.io/en/stable/>`_, you
may use the following commands from a command prompt. Note that this command
prompt is not the python command prompt, but, depending on your operating
system, this is called:

  - A linux terminal window
  - A MacOSX terminal window
  - A Windows Command Prompt

In that windows, please type:

.. code-block:: sh

  # For linux or mac
  which python3
  # Linux and Mac might not have the command python
  which python
  # for windows
  where python
  # Windows might not have the command python3
  where python3

To ensure you know which python executable you are using. For Linux and mac,
we found that depending on their operating system, users should use:

  - For MacOSX: ``python3``
  - For Linux:  ``python3``
  - For Windows: ``python`` (Notice the lack of 3)

Once you have found your python command, use

.. code-blocks:: sh

  python --version
  python3 --version

To ensure the version is at least Python 3.6. If not, you may not be able
to install the most updated version of scikit-image. However,
this should not stop you from installing an older version and get you going
with your image processing project.

We simply suggest you check the installed version of ``scikit-image`` with the
code snippet included at the top of this guide so that you can refer to the
appropriate documentation version.

@tony-p
Copy link

tony-p commented Sep 19, 2023

Any movement on this? There are conda packages (for me robostack/humble) that have scripts with python3 shebangs in the build chain which isn't just about changing user behaviour. Now I am manually adding a symlink, but that doesn't make for very portable environments

CMake Error at D:/.../share/cmake-3.27/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Python3 (missing: Python3_NumPy_INCLUDE_DIRS NumPy)

@tony-p
Copy link

tony-p commented Nov 1, 2023

@isuruf @jjhelmus @xhochy I have made PRs to make a python3 alias via copy. Can they please be merged? The file that is copied is <100kb which I think is ok to get rid of this problem

@isuruf
Copy link
Member

isuruf commented Nov 1, 2023

I still don't see why this is needed.

@hmaarrfk
Copy link
Author

hmaarrfk commented Nov 1, 2023

For original source writers,

It is very difficult to write "cross os" installation and running instructions.

  1. If on ubuntu 20.04 please use the command python3.
  2. if you installed windows please use the command python
  3. if you installed with this method.....

The list kinda goes on.

This really helps first time started get going with python

@isuruf
Copy link
Member

isuruf commented Nov 1, 2023

So, you want to complicate the instructions with the following?

  1. If on ubuntu 20.04 please use the command python3.
  2. If you installed on windows with conda, use the command python3
  3. if you installed windows but not conda, please use the command python
  4. if you installed with this method.....

@hmaarrfk
Copy link
Author

hmaarrfk commented Nov 1, 2023

I would rather say:

  1. Make sure you have a working installation of python. We recommend using the installers from conda-forge.
  2. python3.

In 2020, when I opened the issue, python2 was a real thing. so users accidentally having python2 was a real problem.

I don't think there is a good "solution" to these problems, but I think that adding a python3 command is a good step forward. At the very least, it would add pressure on upstream cpython to add a python3 command on their default windows installer.

@tony-p
Copy link

tony-p commented Nov 1, 2023

The fact that this behaviour is different between linux and windows to me seems like enough of an argument to say the python3 alias should be included.

Further there are packaged tools/scripts that use a python3 shebang, these simply do not work with the base python package (or worse call the global install)

Why I pinged again today is I had to python myenv/Library/tools/the_tool_I_want/script.py because the script used a python3 shebang. This defies the whole point of having an environment

@tony-p
Copy link

tony-p commented Nov 1, 2023

At the very least, it would add pressure on upstream cpython to add a python3 command on their default windows installer.

In Windows they use the pylauncher (what causes more headaches with conda environments) which emulates the python3 aliases, but only for global python installs

@isuruf
Copy link
Member

isuruf commented Nov 1, 2023

Can you both please comment on python/cpython#99185 first?

@hmaarrfk
Copy link
Author

hmaarrfk commented Nov 1, 2023

ok thank you for the constructive comment.

I somewhat remember clashes between name.dll and name.exe.

I'm going to try to test the new entry points before suggesting. I've been hit by similar bugs in the past in other packages.

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

Successfully merging a pull request may close this issue.

3 participants