Can't install exe file in my Python312/Scripts folder

Hello!

I’m trying to update my python version from 3.10 to 3.12, all works perfectly.
When I wrote pip install jupyter I had no issue print, all the correponding packages were installed in Python312/lib/site-packages.

However, the jupyter.exe file isn’t installed in Python312/Scripts folder.

I guess a solution would be to copy paste the Scripts folder from Python310/Scripts to Python312/Scripts, but that won’t be a durable solution.

I’m pretty new to this so if you need any further informations, please tell me (it could be logs or paths etc.)

Thanks!

Its almost always going to be a problem if you copy files from one python installation into another.

I’m not a jupyter user, but I assume that you will install a new jupyter package for 3.12. Following the same steps you used to install for 3.10 I’d guess.

Hi,

why don’t you uninstall v3.10 (and any other versions) and just keep one on your system (the latest version) so that there are no PATH conflict issues when installing packages? Also, when creating scripts, don’t save them to the Python path. Instead, save them to a local directory that is independent of the Python version path so that you won’t have issues when you want to uninstall previous versions.

Hello,

In fact I don’t want to uninstall Python 3.10 before the 3.12 works correctly.
When listing aliases, I can see that pip use correctly the one in my Python312 folder.
Also I changed all Path environemment variables from Python310 to Python312.

I don’t know if I was clear but I don’t really create scripts, it just automaticly builds when I do pip install jupyter in the Python312/Scripts folder before

Where is it installed? Is it installed on v3.10?

or

Which is it?

It is installed in Python310/Scripts/jupyter.exe for the moment yes.

When I say all works correctly, it was until this moment, but code can run using python312

The problem is in front of you.

There can only be one jupyter.exe file even among all python version? I don’t se that anywhere, maybe I miss something?

I’m not saying that I want to use jupyter.exe, I just want pip install jupyter to download jupyter.exe in the Scripts folder

I think that if you are on IDLE vPython 3.12, it will do a search in its own directories. For example, if you have three older versions of Python, its not going to do a search of your system scanning other versions of Python searching for a particular folder or module automatically. This is why, generally , you only want one (the most up to date) version on your system. I am sure that there might be reasons for having multiple versions (maybe you want to recreate a particular bug issue, a customer has a particular version on their system, etc.). You can also append directories to the search PATH, of course, but my preference is just to have the latest version.

If you want to install a module package to a particular Python version, follow this thread:

https://www.reddit.com/r/learnpython/comments/yjgw0t/are_python_packages_tied_to_a_specific_python/?rdt=47487

In your case:

python3.12 -m pip install

Just a small follow up. If you are on IDLE Python v3.12, run the following script. Notice the printout. You will see that the PATH does not include v3.10 directories, only v3.12. So, unless you specifically add/append that directory, it will never find that jupyter package.

import sys

num = 0
 
for i in sys.path:
    print(f"{num}. {i}")
    num += 1

The file “jupyter.exe” is a script wrapper that gets created when the jupyter package is installed. It wraps the main() entry point of the module jupyter_core.command in a particular installation of the jupyter package, such as in a virtual environment or a Python installation. It is equivalent to running python -m jupyter_core.command, where python is the executable for a virtual environment or Python installation.

To find “jupyter.exe”, the system API or shell searches directories in the PATH environment variable sequentially from the first to last entry. The first “jupyter.exe” executable that’s found is the one that gets executed. An activated virtual environment should be first in PATH. If you have multiple “Scripts” directories from different Python installations in PATH, you can symlink, hardlink, or copy the “jupyter.exe” file in each directory to a versioned name such as “jupyter3.12.exe”, or whatever unique name you prefer. For example, from within the “Scripts” directory in an administrator CMD shell, you can create such a symlink by running mklink jupyter3.12.exe jupyter.exe.

Alternatively, use the py command to explicitly run the command in a particular installed version of Python. For example, py -3.12 -m jupyter_core.command. This requires remembering exactly which module gets executed by each script wrapper, which can be tedious and difficult if one frequently uses a lot of script wrappers, but it’s not so bad for just a few that one uses frequently. Also, it may not always be possible because script wrappers can target particular entry point functions in a module, rather than just running the main entry point that gets targeted by using Python’s -m command-line option.

1 Like

Python’s module search path in sys.path has no relation to the system PATH environment variable, os.environ['PATH']. One can print the latter out, with one entry per line, via the following statement: print(*os.environ['PATH'].split(os.pathsep), sep='\n').