emscripten-core / emsdk

Emscripten SDK
http://emscripten.org
Other
2.92k stars 662 forks source link

`emsdk activate latest --permanent` does not add Python's executable to `PATH` #1315

Closed vault-thirteen closed 7 months ago

vault-thirteen commented 7 months ago

As stated in the title, the emsdk activate latest --permanent command does not add Python's executable to the PATH environment variable.

vault-thirteen commented 7 months ago

If you need details, here are they.

After I used the above stated command, it added three (3) following records into my user-level PATH environment variable:

For some reason, the Python's folder which is D:\Temp\1\emsdk\python\3.9.2-nuget_64bit was not added by the tool. I thought that the tool was very smart and saw that Python was already installed, but no. My system did not have any stand-alone Python installation at that time. So, this is a bug, 100%.

sbc100 commented 7 months ago

We deliberately don't add our internal version of python to the user's PATH, but instead set the EMSDK_PYTHON environment variable so that our launchers can use that to find our internal version of python.

The version of python we ship with emsdk is really designed as an implementation detail of emsdk and not designed to be used to other purposes. Is there some reason why you want/need it to be in your PATH?

vault-thirteen commented 7 months ago

No, there is no special reason for that. I can use an external Python. I just thought that it should be in PATH since it was bundled.

vault-thirteen commented 7 months ago

Controversy in environment variables.

There is a controversy.

In this issue 1315 (https://github.com/emscripten-core/emsdk/issues/1315) you say that python (EMSDK_PYTHON) is used only for internal purposes and thus it is not added to PATH variable.

But at the same time nodejs (EMSDK_NODE) is used for the same internal purposes but it is actually added to PATH variable.

EMSDK = D:/Temp/1/emsdk
EMSDK_NODE = D:\Temp\1\emsdk\node\16.20.0_64bit\bin\node.exe
EMSDK_PYTHON = D:\Temp\1\emsdk\python\3.9.2-nuget_64bit\python.exe
JAVA_HOME = D:\Temp\1\emsdk\java\8.152_64bit
Clearing existing environment variable: EMSDK_PY
Adding directories to PATH:
PATH += D:\Temp\1\emsdk
PATH += D:\Temp\1\emsdk\node\16.20.0_64bit\bin
PATH += D:\Temp\1\emsdk\upstream\emscripten
sbc100 commented 7 months ago

There is a controversy. In this issue you say that python is used only for internal purposes and thus it is not added to PATH variable. But nodejs is used for the same internal purposes but it is actually added to PATH variable.

EMSDK = D:/Temp/1/emsdk
EMSDK_NODE = D:\Temp\1\emsdk\node\16.20.0_64bit\bin\node.exe
EMSDK_PYTHON = D:\Temp\1\emsdk\python\3.9.2-nuget_64bit\python.exe
JAVA_HOME = D:\Temp\1\emsdk\java\8.152_64bit
Clearing existing environment variable: EMSDK_PY
Adding directories to PATH:
PATH += D:\Temp\1\emsdk
PATH += D:\Temp\1\emsdk\node\16.20.0_64bit\bin
PATH += D:\Temp\1\emsdk\upstream\emscripten

The situation with node is a little more completed. Historically we always added it to the PATH so that folk could run the output of emcc (e.g. for running test) so there is at least some need to node that is not internal. However a lot of foks were getting confused because we were clobber their existing version of node in their PATH.

As a compromise we settled on a solution where node is added, but only if it doesn't already exist in the users PATH: #1189. i.e. if you install your own version of node emsdk will stop adding node to your path.