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

Not able to use Python free-threaded interpreter as custom one in Preferences #23635

Open
nikimagic opened this issue Feb 3, 2025 · 16 comments

Comments

@nikimagic
Copy link

nikimagic commented Feb 3, 2025

You cannot select python3.13t environment
Spyder 6.0.3
Windows.

Image

@nikimagic nikimagic changed the title Python 3.13t not available Python 3.13t not available. Feb 4, 2025
@nikimagic nikimagic changed the title Python 3.13t not available. Python 3.13t not available. Spyder 6.0.3. Windows 10. Feb 4, 2025
@BranChai
Copy link

BranChai commented Feb 4, 2025

把python3.13t文件名修改为python3.13试试,注意备份数据

@nikimagic
Copy link
Author

Попробую

Image

@dalthviz
Copy link
Member

dalthviz commented Feb 4, 2025

Hi @nikimagic thank you for the feedback! I think this validation error is caused due to the name of the executable selected. I think you did an attempt to change the name of the executable? From the screenshot seems like you have a python.exe executable file. Does selecting that executable shows also the validation?

Let us know!

@nikimagic
Copy link
Author

nikimagic commented Feb 5, 2025

Hi @nikimagic thank you for the feedback! I think this validation error is caused due to the name of the executable selected. I think you did an attempt to change the name of the executable? From the screenshot seems like you have a python.exe executable file. Does selecting that executable shows also the validation?

Let us know!

Image

By default everything works.

But it is impossible to select the file python3.13t.exe in the spider

It should be
Python 3.13.1 experimental free-threading build (tags/v3.13.1:0671451, Dec 3 2024, 19:02:27)

Image

Image

import sys
print (" GIL:", sys._is_gil_enabled() )

@dalthviz
Copy link
Member

dalthviz commented Feb 5, 2025

Thank you for the new info @nikimagic ! I see, so you are trying to set as custom interpreter the free-threaded version which comes in the name with the extra t. Checking a little bit more, indeed the validation error is being caused due to some logic we have to validate that the name of the executable selected corresponds to a valid one with a regex at

def is_python_interpreter_valid_name(filename):
"""Check that the python interpreter file has a valid name."""
pattern = r'.*python(\d\.?\d*)?(w)?(.exe)?$'
if re.match(pattern, filename, flags=re.I) is None:
return False
else:
return True

I think the regex above could be changed to be something like:

.*python(\d\.?\d*t?)?(w)?(.exe)?$

That should be enough to leave as valid the interpreter file with the extra t. What do you think @ccordoba12 ?

@dalthviz dalthviz changed the title Python 3.13t not available. Spyder 6.0.3. Windows 10. Invalid file path error message when trying to use Python free-threaded interpreter executable as custom interpreter (Python 3.13t not available - Spyder 6.0.3 - Windows 10) Feb 5, 2025
@nikimagic
Copy link
Author

Please note!!!
File names available in the python directory.

python.exe
python_d.exe
python3.13t.exe
python3.13t_d.exe

@dalthviz
Copy link
Member

dalthviz commented Feb 5, 2025

Oh right, probably also some (d)ebug build there. Maybe then a regex like:

 .*python(\d\.?\d*t?_?d?)?(w)?(.exe)?$

Could it be possible for you @nikimagic to check if changing the regex on your Spyder installation for the one above helps in regards of selecting the interpreters you have available? Let us know!

@ccordoba12
Copy link
Member

That should be enough to leave as valid the interpreter file with the extra t. What do you think @ccordoba12 ?

@dalthviz, yeah, it should be enough to cover this new case.

File names available in the python directory.
python_d.exe

@nikimagic, what the _d stands for?

@nikimagic
Copy link
Author

Этого должно быть достаточно, чтобы оставить файл интерпретатора действительным с дополнительным t. Что вы думаете?@ccordoba12?

@dalthviz, да, этого должно быть достаточно, чтобы покрыть это новое дело.

Имена файлов, доступные в каталоге python.
python_d.exe

@nikimagic, что _dозначает?

The output filename should be python{major}.{minor}t.exe and python{major}{minor}t.dll. Debug builds are python{major}.{minor}t_d.exe and python{major}{minor}t_d.dll.

python/cpython#112984

@ccordoba12 ccordoba12 changed the title Invalid file path error message when trying to use Python free-threaded interpreter executable as custom interpreter (Python 3.13t not available - Spyder 6.0.3 - Windows 10) Not able to use Python free-threaded interpreter as custom one Feb 5, 2025
@ccordoba12 ccordoba12 changed the title Not able to use Python free-threaded interpreter as custom one Not able to use Python free-threaded interpreter as custom one in Preferences Feb 5, 2025
@nikimagic
Copy link
Author

nikimagic commented Feb 5, 2025

Oh right, probably also some (d)ebug build there. Maybe then a regex like:

 .*python(\d\.?\d*t?_?d?)?(w)?(.exe)?$

Could it be possible for you @nikimagic to check if changing the regex on your Spyder installation for the one above helps in regards of selecting the interpreters you have available? Let us know!

Image

Image

Image

console1

Traceback (most recent call last):
File "C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\site‑packages\spyder_kernels\console_main_.py", line 24, in
start.main()

File "C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\site‑packages\spyder_kernels\console\start.py", line 151, in main
import_spydercustomize()
~~~~~~~~~~~~~~~~~~~~~~^^
File "C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\site‑packages\spyder_kernels\console\start.py", line 41, in import_spydercustomize
import spydercustomize # noqa
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\site‑packages\spyder_kernels\customize\spydercustomize.py", line 19, in
from spyder_kernels.customize.spyderpdb import SpyderPdb
File "C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\site‑packages\spyder_kernels\customize\spyderpdb.py", line 28, in
from spyder_kernels.comms.frontendcomm import CommError, frontend_request
File "C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\site‑packages\spyder_kernels\comms\frontendcomm.py", line 18, in
import zmq
File "C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\site‑packages\zmq\__init__.py", line 52, in
from zmq import backend
File "C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\site‑packages\zmq\backend\__init__.py", line 30, in
raise original_error from None
File "C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\site‑packages\zmq\backend\__init__.py", line 25, in
_ns = select_backend(first)
File "C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\site‑packages\zmq\backend\select.py", line 31, in select_backend
mod = import_module(name)
File "C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\importlib\__init__.py", line 88, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\site‑packages\zmq\backend\cython\__init__.py", line 6, in
from . import _zmq
File "C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\site‑packages\zmq\backend\cython\_zmq.py", line 33, in
raise ImportError(msg)
ImportError:
Attempting to import zmq Cython backend, which has not been compiled.

This probably means you are importing zmq from its source tree.
if this is what you want, make sure to do an in‑place build first:

pip install ‑e 'C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\site‑packages'

If it is not, then 'C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\site‑packages' is probably on your sys.path,
when it shouldn't be. Is that your current working directory?

If neither of those is true and this file is actually installed,
something seems to have gone wrong with the install!
Please report at https://github.com/zeromq/pyzmq/issues

Traceback (most recent call last):
File "C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\runpy.py", line 198, in _run_module_as_main
return _run_code(code, main_globals, None,
"__main__", mod_spec)
File "C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\runpy.py", line 88, in _run_code
exec(code, run_globals)
~~~~^^^^^^^^^^^^^^^^^^^
File "C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\site‑packages\spyder_kernels\console\__main__.py", line 24, in
start.main()
~~~~~~~~~~^^
File "C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\site‑packages\spyder_kernels\console\start.py", line 151, in main
import_spydercustomize()
~~~~~~~~~~~~~~~~~~~~~~^^
File "C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\site‑packages\spyder_kernels\console\start.py", line 41, in import_spydercustomize
import spydercustomize # noqa
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\site‑packages\spyder_kernels\customize\spydercustomize.py", line 19, in
from spyder_kernels.customize.spyderpdb import SpyderPdb
File "C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\site‑packages\spyder_kernels\customize\spyderpdb.py", line 28, in
from spyder_kernels.comms.frontendcomm import CommError, frontend_request
File "C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\site‑packages\spyder_kernels\comms\frontendcomm.py", line 18, in
import zmq
File "C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\site‑packages\zmq\__init__.py", line 52, in
from zmq import backend
File "C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\site‑packages\zmq\backend\__init__.py", line 30, in
raise original_error from None
File "C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\site‑packages\zmq\backend\__init__.py", line 25, in
_ns = select_backend(first)
File "C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\site‑packages\zmq\backend\select.py", line 31, in select_backend
mod = import_module(name)
File "C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\importlib\__init__.py", line 88, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\site‑packages\zmq\backend\cython\__init__.py", line 6, in
from . import _zmq
File "C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\site‑packages\zmq\backend\cython\_zmq.py", line 33, in
raise ImportError(msg)
ImportError:
Attempting to import zmq Cython backend, which has not been compiled.

This probably means you are importing zmq from its source tree.
if this is what you want, make sure to do an in‑place build first:

pip install ‑e 'C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\site‑packages'

If it is not, then 'C:\Users\BoSyA\AppData\Local\Programs\Python\Python313\Lib\site‑packages' is probably on your sys.path,
when it shouldn't be. Is that your current working directory?

If neither of those is true and this file is actually installed,
something seems to have gone wrong with the install!
Please report at https://github.com/zeromq/pyzmq/issues

@dalthviz
Copy link
Member

dalthviz commented Feb 5, 2025

Thank you for the check! So it seems like the suggested change to the regex indeed enables you to select the free-threaded interpreter 👍 Regarding the error, seems like we need to do something over spyder-kernels to support a free-threaded Python interpreter @ccordoba12 ? Probably creating a new issue for that could be worthy? 🤔

@nikimagic
Copy link
Author

Thank you for the check! So it seems like the suggested change to the regex indeed enables you to select the free-threaded interpreter 👍 Regarding the error, seems like we need to do something over spyder-kernels to support a free-threaded Python interpreter @ccordoba12 ? Probably creating a new issue for that could be worthy? 🤔

I will be happy to help and check any new versions.

@nikimagic
Copy link
Author

Image

@ccordoba12
Copy link
Member

According to this page, there are no free-threaded wheels for PyZMQ on Windows. That's the main binary dependency required by Spyder-kernels, so it can't work without it.

For now there's nothing we can do about it, sorry @nikimagic.

@ccordoba12 ccordoba12 modified the milestones: v6.0.5, v6.x.x Feb 5, 2025
@nikimagic
Copy link
Author

According to this page, there are no free-threaded wheels for PyZMQ on Windows. That's the main binary dependency required by Spyder-kernels, so it can't work without it.

For now there's nothing we can do about it, sorry @nikimagic.

Thank you

@nikimagic
Copy link
Author

nikimagic commented Feb 7, 2025

I will continue....

python3.13t -m venv venv313t
cd venv313t
Scripts\activate
python.exe -m pip install --upgrade pip
pip install spyder-kernels

error

python -m venv venv313
cd venv313
Scripts\activate
python.exe -m pip install --upgrade pip
pip install spyder-kernels

no error!   

Image

Image

(venv313t) C:\Users\BoSyA\venv313t>pip install spyder-kernels
Collecting spyder-kernels
Using cached spyder_kernels-3.0.3-py3-none-any.whl.metadata (5.2 kB)
Collecting cloudpickle (from spyder-kernels)
Using cached cloudpickle-3.1.1-py3-none-any.whl.metadata (7.1 kB)
Collecting ipykernel<7,>=6.29.3 (from spyder-kernels)
Using cached ipykernel-6.29.5-py3-none-any.whl.metadata (6.3 kB)
Collecting ipython!=8.17.1,<9,>=8.13.0 (from spyder-kernels)
Using cached ipython-8.32.0-py3-none-any.whl.metadata (5.0 kB)
Collecting jupyter-client<9,>=7.4.9 (from spyder-kernels)
Using cached jupyter_client-8.6.3-py3-none-any.whl.metadata (8.3 kB)
Collecting pyzmq>=24.0.0 (from spyder-kernels)
Using cached pyzmq-26.2.1.tar.gz (278 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Collecting comm>=0.1.1 (from ipykernel<7,>=6.29.3->spyder-kernels)
Using cached comm-0.2.2-py3-none-any.whl.metadata (3.7 kB)
Collecting debugpy>=1.6.5 (from ipykernel<7,>=6.29.3->spyder-kernels)
Using cached debugpy-1.8.12-py2.py3-none-any.whl.metadata (1.3 kB)
Collecting jupyter-core!=5.0.,>=4.12 (from ipykernel<7,>=6.29.3->spyder-kernels)
Using cached jupyter_core-5.7.2-py3-none-any.whl.metadata (3.4 kB)
Collecting matplotlib-inline>=0.1 (from ipykernel<7,>=6.29.3->spyder-kernels)
Using cached matplotlib_inline-0.1.7-py3-none-any.whl.metadata (3.9 kB)
Collecting nest-asyncio (from ipykernel<7,>=6.29.3->spyder-kernels)
Using cached nest_asyncio-1.6.0-py3-none-any.whl.metadata (2.8 kB)
Collecting packaging (from ipykernel<7,>=6.29.3->spyder-kernels)
Using cached packaging-24.2-py3-none-any.whl.metadata (3.2 kB)
Collecting psutil (from ipykernel<7,>=6.29.3->spyder-kernels)
Using cached psutil-6.1.1.tar.gz (508 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting tornado>=6.1 (from ipykernel<7,>=6.29.3->spyder-kernels)
Using cached tornado-6.4.2.tar.gz (501 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting traitlets>=5.4.0 (from ipykernel<7,>=6.29.3->spyder-kernels)
Using cached traitlets-5.14.3-py3-none-any.whl.metadata (10 kB)
Collecting colorama (from ipython!=8.17.1,<9,>=8.13.0->spyder-kernels)
Using cached colorama-0.4.6-py2.py3-none-any.whl.metadata (17 kB)
Collecting decorator (from ipython!=8.17.1,<9,>=8.13.0->spyder-kernels)
Using cached decorator-5.1.1-py3-none-any.whl.metadata (4.0 kB)
Collecting jedi>=0.16 (from ipython!=8.17.1,<9,>=8.13.0->spyder-kernels)
Using cached jedi-0.19.2-py2.py3-none-any.whl.metadata (22 kB)
Collecting prompt_toolkit<3.1.0,>=3.0.41 (from ipython!=8.17.1,<9,>=8.13.0->spyder-kernels)
Using cached prompt_toolkit-3.0.50-py3-none-any.whl.metadata (6.6 kB)
Collecting pygments>=2.4.0 (from ipython!=8.17.1,<9,>=8.13.0->spyder-kernels)
Using cached pygments-2.19.1-py3-none-any.whl.metadata (2.5 kB)
Collecting stack_data (from ipython!=8.17.1,<9,>=8.13.0->spyder-kernels)
Using cached stack_data-0.6.3-py3-none-any.whl.metadata (18 kB)
Collecting python-dateutil>=2.8.2 (from jupyter-client<9,>=7.4.9->spyder-kernels)
Using cached python_dateutil-2.9.0.post0-py2.py3-none-any.whl.metadata (8.4 kB)
Collecting parso<0.9.0,>=0.8.4 (from jedi>=0.16->ipython!=8.17.1,<9,>=8.13.0->spyder-kernels)
Using cached parso-0.8.4-py2.py3-none-any.whl.metadata (7.7 kB)
Collecting platformdirs>=2.5 (from jupyter-core!=5.0.
,>=4.12->ipykernel<7,>=6.29.3->spyder-kernels)
Using cached platformdirs-4.3.6-py3-none-any.whl.metadata (11 kB)
INFO: pip is looking at multiple versions of jupyter-core to determine which version is compatible with other requirements. This could take a while.
Collecting jupyter-core!=5.0.*,>=4.12 (from ipykernel<7,>=6.29.3->spyder-kernels)
Using cached jupyter_core-5.7.1-py3-none-any.whl.metadata (3.4 kB)
Using cached jupyter_core-5.7.0-py3-none-any.whl.metadata (3.4 kB)
Using cached jupyter_core-5.6.1-py3-none-any.whl.metadata (3.4 kB)
Using cached jupyter_core-5.5.1-py3-none-any.whl.metadata (3.4 kB)
Using cached jupyter_core-5.5.0-py3-none-any.whl.metadata (3.4 kB)
Using cached jupyter_core-5.4.0-py3-none-any.whl.metadata (3.4 kB)
Using cached jupyter_core-5.3.2-py3-none-any.whl.metadata (3.4 kB)
INFO: pip is still looking at multiple versions of jupyter-core to determine which version is compatible with other requirements. This could take a while.
Using cached jupyter_core-5.3.1-py3-none-any.whl.metadata (3.4 kB)
Using cached jupyter_core-5.3.0-py3-none-any.whl.metadata (3.4 kB)
Using cached jupyter_core-5.2.0-py3-none-any.whl.metadata (5.1 kB)
Using cached jupyter_core-5.1.5-py3-none-any.whl.metadata (5.1 kB)
Using cached jupyter_core-5.1.4-py3-none-any.whl.metadata (5.1 kB)
INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. See https://pip.pypa.io/warnings/backtracking for guidance. If you want to abort this run, press Ctrl + C.
Using cached jupyter_core-5.1.3-py3-none-any.whl.metadata (5.1 kB)
Using cached jupyter_core-5.1.2-py3-none-any.whl.metadata (5.1 kB)
Using cached jupyter_core-5.1.1-py3-none-any.whl.metadata (4.9 kB)
Using cached jupyter_core-5.1.0-py3-none-any.whl.metadata (4.9 kB)
Using cached jupyter_core-4.12.0-py3-none-any.whl.metadata (4.7 kB)
Collecting jupyter-client<9,>=7.4.9 (from spyder-kernels)
Using cached jupyter_client-8.6.2-py3-none-any.whl.metadata (8.3 kB)
Collecting ipykernel<7,>=6.29.3 (from spyder-kernels)
Using cached ipykernel-6.29.4-py3-none-any.whl.metadata (6.3 kB)
Using cached ipykernel-6.29.3-py3-none-any.whl.metadata (6.3 kB)
ERROR: Cannot install ipykernel because these package versions have conflicting dependencies.

The conflict is caused by:
jupyter-core 5.7.2 depends on pywin32>=300; sys_platform == "win32" and platform_python_implementation != "PyPy"
jupyter-core 5.7.1 depends on pywin32>=300; sys_platform == "win32" and platform_python_implementation != "PyPy"
jupyter-core 5.7.0 depends on pywin32>=300; sys_platform == "win32" and platform_python_implementation != "PyPy"
jupyter-core 5.6.1 depends on pywin32>=300; sys_platform == "win32" and platform_python_implementation != "PyPy"
jupyter-core 5.5.1 depends on pywin32>=300; sys_platform == "win32" and platform_python_implementation != "PyPy"
jupyter-core 5.5.0 depends on pywin32>=300; sys_platform == "win32" and platform_python_implementation != "PyPy"
jupyter-core 5.4.0 depends on pywin32>=300; sys_platform == "win32" and platform_python_implementation != "PyPy"
jupyter-core 5.3.2 depends on pywin32>=300; sys_platform == "win32" and platform_python_implementation != "PyPy"
jupyter-core 5.3.1 depends on pywin32>=300; sys_platform == "win32" and platform_python_implementation != "PyPy"
jupyter-core 5.3.0 depends on pywin32>=300; sys_platform == "win32" and platform_python_implementation != "PyPy"
jupyter-core 5.2.0 depends on pywin32>=1.0; sys_platform == "win32" and platform_python_implementation != "PyPy"
jupyter-core 5.1.5 depends on pywin32>=1.0; sys_platform == "win32" and platform_python_implementation != "PyPy"
jupyter-core 5.1.4 depends on pywin32>=1.0; sys_platform == "win32" and platform_python_implementation != "PyPy"
jupyter-core 5.1.3 depends on pywin32>=1.0; sys_platform == "win32" and platform_python_implementation != "PyPy"
jupyter-core 5.1.2 depends on pywin32>=1.0; sys_platform == "win32" and platform_python_implementation != "PyPy"
jupyter-core 5.1.1 depends on pywin32>=1.0; sys_platform == "win32" and platform_python_implementation != "PyPy"
jupyter-core 5.1.0 depends on pywin32>=1.0; sys_platform == "win32" and platform_python_implementation != "PyPy"
jupyter-core 4.12.0 depends on pywin32>=1.0; sys_platform == "win32" and platform_python_implementation != "PyPy"

To fix this you could try to:

  1. loosen the range of package versions you've specified
  2. remove package versions to allow pip to attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

(venv313t) C:\Users\BoSyA\venv313t>

Image

version of the environment without t

Image

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

No branches or pull requests

4 participants