emscripten-core / emscripten-core/emsdk

emsdk.ps1 does not find python on Windows

Open
#1,589 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
3.7k
Forks
821
Avg merge
1h 25m
Merged PRs (30d)
3

Description

I am using Windows 11. I have python 3.13.7 installed. I use powershell 7.5.2
```
λ python --version
Python 3.11.7
```

I run `./emsdk/emsdk_env.ps1` to activate my environment:
```
Setting up EMSDK environment (suppress these messages with EMSDK_QUIET=1)
Adding directories to PATH:
PATH += /c/installation_path/of/emsdk
PATH += /c/installation_path/of/emsdk/upstream/emscripten

Setting environment variables:
PATH = ... very long array of paths ...
EMSDK = C:/installation_path/of/emsdk
EMSDK_NODE = C:/installation_path/of/emsdk/node/22.16.0_64bit/bin/node.exe
EMSDK_PYTHON = C:/installation_path/of/emsdk/python/3.13.3_64bit/python.exe
```

Afterwards, I notice the following:

1. Python is no longer in the PATH
```
λ python
python: The term 'python' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
```

2. The variable "EMSDK_PYTHON" is not defined like the output of the script seems to imply, but "$env:EMSDK_PYTHON" is:
```
λ echo $EMSDK_PYTHON

λ echo $env:EMSDK_PYTHON
C:/installation_path/of/emsdk/python/3.13.3_64bit/python.exe
```

3. emsdk.ps1, which uses the `$EMSDK_PYTHON` variable does not work:

```
λ .\emsdk\emsdk.ps1 install 4.0.13
Line |
26 | & $EMSDK_PY "$ScriptDirectory/emsdk.py" $args
| ~~~~~~~~~
| The term 'python' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the
| spelling of the name, or if a path was included, verify that the path is correct and try again.
```

If I replace occurrences of `$EMSDK_PY` by `$env:EMSDK_PY` in this script, the installation of components seems to work again.

However, `.\emsdk\emsdk.ps1 activate 4.0.13` does not work in the sense that `emcc` or `em++` are not added to the path.

Is there something wrong with my environment or is the `emsdk.ps1` script incorrect?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.