0

I've been trying to set a virtual environment for some time now, but with no success. I read many topics regarding this manner, but couldn't find a solution for my problem.

I am running:

Windows 7

Pycharm Community Edition 2017.1.4

Anaconda 2

Python 2.7.13

I am trying to set up an environment of Python 3.5.3 - Anaconda I used this command:

conda create -n py35 python=3.5 anaconda

(also tried : conda create -n py35 python=3.5.3 anaconda) same result

via PyCharm terminal. It does seem that it sets up an environment and I am able to switch between them in the terminal, but when I try to add it as a local Interpreter I keep receiving a message:

Cannot set up a python SDK at Python 3.5.3 (C:\Users\Cossack\Anaconda2\envs\py35\python.exe) (C:\Users\Cossack\Anaconda2\envs\py35\python.exe). The SDK seems invalid.

I also tried creating conda Env via PyCharm settings, but same error appears. I tried creating environment for python 3.6 just to see if that was the problem source, but again, the same error appeared.

I really need both Python 2.7 and 3.5, but I keep getting errors which I have no Idea on how to solve.

Thank you very much in advance, hope that someone can help me in solving this issue.

DmitryP
  • 1
  • 2

2 Answers2

0

Googling Cannot set up a python SDK at Python returns a number of stack overflow discussions

Cannot set up a python SDK in Pycharm?

Invalid Python SDK Error while using python 3.4 on pycharm

Multilpe python versions and interpreters

All of these hint to the PYTHONPATH being setup incorrectly and pointing to the wrong place. Is your issue different than these in any way? Have you tried setting up PYTHONPATH env var for windows?

nanotek
  • 2,959
  • 15
  • 25
  • Hello. Thank you for your reply. I already came across these. The first one didn't work and more than that, it broke my already existing setup and I had to reinstall everything all over again (that has really made me mad since I have many external tools I had to set up all over again). The second one doesn't explain how do I find this "Bach File", I googled it, but still couldn't understand how to locate it. – DmitryP Jul 05 '17 at 04:46
  • You shouldn't need to re-install after modifying the windows environment variable. At most I would suspect reverting it and restarting the application, or `File | Invalidate caches / Restart`. The `~/.bash_profile` is a specific linux file, but the thing to note is they are adding `PYTHONPATH` env var info to it. How are you trying to `add a local interpreter to it`. Are you inside of PyCharm or on the windows CMD line? The PYTHONPATH variable is likely how the tool knows about your different python installs. In the 1st link he uses py2.7. Yours would be wherever you installed py3.5. – nanotek Jul 05 '17 at 14:17
0

Thank you for your answers and help.

After I've completely removed Anaconda and all the side packages, and reinstalled everything from scratch, the method I mention in the question worked fine and without any setbacks.

Although it's frustrating to reinstall everything from scratch, it solved the problem.

For some reason, changing the Path backfired and nothing worked at all after that and even when I tried to restore the previous Path, it wouldn't work anymore. So if anyone has the same issue when mentioned above doesn't work, all I can suggest is to fully reinstall the program.

DmitryP
  • 1
  • 2