spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.22k stars 1.59k forks source link

Python interpreter not working for Python 3.6.0 environment #12615

Open eghbalhosseini opened 4 years ago

eghbalhosseini commented 4 years ago

Issue Report Checklist

Problem Description

I am trying to create 2 python interpreter for spyder, one using python 3.8 and another using 3.6. Spyder is installed using Conda in 'base' environment and the python there is 3.7.7 first environment is using python 3.8.2 , and python interpreter is working under it. second environment is using python 3.6.0, and python interpreter is not working under it. the error is "You selected an invalid Python interpreter for the console so the previous interpreter will stay. Please make sure to select a valid one."

for creating the kernels I used the following instruction: https://github.com/spyder-ide/spyder/wiki/Working-with-packages-and-environments-in-Spyder the section: The modular approach

What steps reproduce the problem?

  1. conda create -n myenv python=3.6 conda activate myenv conda install spyder-kernels python -c "import sys; print(sys.executable)" conda deactivate spyder

and following the procedure in modular approach

Paste Traceback/Error Below (if applicable)

You selected an invalid Python interpreter for the console so the previous interpreter will stay. Please make sure to select a valid one.


Spyder Internal Console

This console is used to report application
internal errors and to inspect Spyder
internals with the following commands:
  spy.app, spy.window, dir(spy)

Please don't use it to run your code

Versions

Dependencies


# Mandatory:
applaunchservices >=0.1.7      :  0.2.1 (OK)
atomicwrites >=1.2.0           :  1.4.0 (OK)
chardet >=2.0.0                :  3.0.4 (OK)
cloudpickle >=0.5.0            :  1.4.1 (OK)
diff_match_patch >=20181111    :  20181111 (OK)
intervaltree                   :  None (OK)
IPython >=4.0                  :  7.13.0 (OK)
jedi =0.15.2                   :  0.15.2 (OK)
nbconvert >=4.0                :  5.6.1 (OK)
numpydoc >=0.6.0               :  0.9.2 (OK)
parso =0.5.2                   :  0.5.2 (OK)
pexpect >=4.4.0                :  4.8.0 (OK)
pickleshare >=0.4              :  0.7.5 (OK)
psutil >=5.3                   :  5.7.0 (OK)
pygments >=2.0                 :  2.6.1 (OK)
pylint >=0.25                  :  2.5.0 (OK)
pyls >=0.31.9;<0.32.0          :  0.31.10 (OK)
qdarkstyle >=2.8               :  2.8.1 (OK)
qtawesome >=0.5.7              :  0.7.0 (OK)
qtconsole >=4.6.0              :  4.7.3 (OK)
qtpy >=1.5.0                   :  1.9.0 (OK)
rtree >=0.8.3                  :  0.9.4 (OK)
sphinx >=0.6.6                 :  3.0.3 (OK)
spyder_kernels >=1.9.0;<1.10.0 :  1.9.0 (OK)
watchdog                       :  None (OK)
zmq >=17                       :  18.1.1 (OK)

# Optional:
cython >=0.21                  :  0.29.17 (OK)
matplotlib >=2.0.0             :  3.1.3 (OK)
numpy >=1.7                    :  1.18.1 (OK)
pandas >=0.13.1                :  1.0.3 (OK)
scipy >=0.17.0                 :  1.4.1 (OK)
sympy >=0.7.3                  :  1.5.1 (OK)
steff456 commented 4 years ago

Hi @eghbalhosseini,

Can you please send me an screenshot to see which file is selected under Preferences > Python Interpreter?

eghbalhosseini commented 4 years ago

spyder_python

steff456 commented 4 years ago

You need to determine your own Python interpreter using the one in the path of the environment you created.

Let me know if that works!

eghbalhosseini commented 4 years ago

thanks. I am a bit confused though, I used the command sys.executable to get the following path, not sure how to get the path you are mentioning.

eghbalhosseini commented 4 years ago

I think this has to do with conda environment using python=3.6 . if I keep everything the same and only change the python version to 3.7 then the path works for spyder

ccordoba12 commented 4 years ago

I think this has to do with conda environment using python=3.6

Yes, I think so too. It seems we're failing to do the proper validation for a Python interpreter when it's version is 3.6.

RyleighFitz commented 4 years ago

I'm getting this exact same issue, but for a conda environment with Python 3.8. It looks like there are plans to address this for Python 3.6. It may be worthwhile to address it for 3.8 as well?

eghbalhosseini commented 4 years ago

I think python 3.8 works for me in this case.

ccordoba12 commented 4 years ago

We've been unable to reproduce this one, unfortunately.

vdveen commented 3 years ago

I've ran into this issue today. I have a 3.7.9 Python virtualenv that I wanted to run from Spyder. The virutalenv is created by Anaconda via ArcGIS Pro.

When I select the python.exe from Spyder installed with Winpython64-3.9.1.0cod (which has Spyder 4.2.1) I get the following Invalid Path error, regardless of whether I select the path from the file explorer or paste it manually:

2021-02-06 11_58_03-Preferences

The same 3.7.9 Python environment is automatically detected and runs without a hitch with the VS Code that comes with the Winpy package.

When I select the exact same path in Spyder installed with Winpython64-3.7.7.1cod (which has Spyder 4.1.3) I do not get any error:

2021-02-06 11_56_20-Preferences

ccordoba12 commented 3 years ago

Hey @vdveen, thanks for reporting. You said:

I've ran into this issue today. I have a 3.7.9 Python virtualenv that I wanted to run from Spyder. The virutalenv is created by Anaconda via ArcGIS Pro.

Could you let us know the exact command you used to create your virtualenv? That way we'll be able to run it on our side and try to reproduce your problem.

vdveen commented 3 years ago

Hi! I can't, since I created the Python installation through the ArcGIS software GUI. I can however list all the packages, and I've created an environment.yaml file for that specific virtual env. Both are attached.

env.yaml conda list.txt

Would this suffice for your ability to reproduce the problem?

ccordoba12 commented 3 years ago

Thanks @vdveen for the list. Unfortunately, it seems there are several packages that belong to the esri channel (I haven't heard of it), so this doesn't seem simple to reproduce. Since right now we are quite busy with other things, we don't have time to debug your problem, sorry.

subrahamanya-Dhiomics commented 2 years ago

@ccordoba12 How can you close this issue when people are still facing this issue ?

Still spyder is showing invalid path while changing the environment .

ccordoba12 commented 2 years ago

I don't understand what you mean, the issue is open. But we don't know how to reproduce it.

fulequn commented 1 year ago

I also encountered this problem when I was using python 3.6.1. Unfortunately, I have used all of the methods in the issue without success on my computer. I guess one possible reason is the lack of venvlauncher.exe in the Python 3.6 virtual environment. Hopefully this will help others with this problem.