Anaconda not available in PyCharm - python

I have just installed Anaconda 3.6 and PyCharm. I am trying to set up the interpreter, however if I navigate to the interpreter window I can see the error message saying "Conda executable not found" as well as "Environment location directory is not empty".
Please see the screenshot below. Do you have any suggestion what I could do? I deleted Anaconda and Pycharm already and re-installed them again without success.
I must also say that my untitled folder under Location is already empty.

I had a similar issue, here you go.
file->settings->project->Project Interpreter-> % for rest see attached pic :)

I think that the problem is your path to file.
For example, the Project Interpreter window of my PyCharm, looks like this:
I know we have different Anaconda versions, but i believe that the files are relatively the same. I suppose that you need the Python file contained in the bin folder, not the conda.
Hope it helps

I found the solution by adding the Conda executable file like this. Both PyCharm and Anaconda are installed in the E drive.

I had the same problem. Just make sure your conda executable path is correct. cd to the path you see in the pycharm. If it doesn't exist, then you have to find and input the right path.

Related

VS Code doesn't recognize Python Virtual Environment Packages - It shows red underlines

I installed python virtual env. I use vs code. I imported scrapy in my code and vs code doesn't recognize the module. Actually, it works well when I run it. scrapy crawl tester
Just, vs code shows red underlines that mean "Unable to import scrapy" So this is just vs code issue, not venv or scrapy package install issue.
This code works well and actuallay, scrapy is imported without any issue. This is just vs code issue. Thank you.
You might be able to solve your problem by using CTRL+Shift+P to add "Python: Select Interpreter" to your project.
If you created a virtual environment and activated it as well
type which python on macOS/Linux,
type where python on Windows,
inside the activated terminal session.
(env) userpc#pc:~$ which python
/home/userpc/Desktop/foldername/env/bin/python
In VSCode press Ctrl+Shift+P, under >Select Interpreter paste the location you receive using the former command.
Once done, restart VSCode.
VSCode will also ask you to install pylint in your environment and if it doesn't you can do the same by activating you environment and typing
pip install pylint
inside the activated terminal session.
Ran into the same problem - selected the correct Python interpreter in VS Code, pip installed all the desired Python libraries but import is still underlined in VS Code.
What you need to do
What worked for me is to make sure that the linter that you are using in this VS Code instance (I was using pylint) is from the bin folder of the virtual environment, not somewhere else.
How you can do it
I'll use the absolute path to the desired virtual environment /User/ProjectFolder/env as an example.
To check that you meet the conditions stated in What you need to do, toggle the settings.json file in VS Code by pressing ⌘ + ,:
Make sure that the correct Python interpreter is selected. i.e. "python.pythonPath":/User/ProjectFolder/env/bin/python3.
Make sure that the linter (e.g. pylint) is located in that bin folder, not anywhere else. i.e "python.linting.pylintPath":/User/ProjectFolder/env/bin/pylint, NOT something like "python.linting.pylintPath":/usr/local/bin/pylint.
This means that you have to install your desired linter in the virtual environment.
Hope this helps.
I tried #cleon-w's answer which worked for me. (Thanks Cleon)
I was using pyenv on my Mac M1 (Big Sur) with vscode. vscode could not resolve the
paths to python that the pyenv provides, so I looked within the pyenv scripts to find the absolute paths
to the underlying python and the pylint files.
As #Cleon W says I ensured pylint and python are in the same bin directory.
Then edit VS Code settings.json to point to them directly (bypass .pyenv) and the imports could be found.
settings.json (vscode)
"python.defaultInterpreterPath": "/Users/USERNAME/.pyenv/shims/python",
"python.pythonPath": "/Users/USERNAME/.pyenv/versions/3.9.1/bin/python",
I have similar problem with Django. What solved my problem was:
create .vscode/settings.json file inside root dir for project.
add this json {"python.defaultInterpreterPath": "path to bin directory in root dir for project"}
Ctrl-Shif-P -> Python: Select Interpreter -> select one that said: Use Python from python.defaultInterpreterPath. If it's not in the list, hit refresh (circled refresh button on the top of settings box).

How to resolve "Invalid Python interpreter name 'python.exe'!" error in PyCharm

I'm trying to add my Python interpreter to PyCharm but whenever I navigate to python.exe and click Ok it says Invalid Python interpeter name 'python.exe'! (the spelling mistake for interpeter is how it's spelled in the dialog that appears)
I installed Python through the Microsoft app store. The interpreter is located at ~\AppData\Local\Microsoft\WindowsApps\python.exe. This is the path I navigate to when selecting the interpreter in PyCharm. There are also python3.exe and python3.7.exe but those don't work either. I can run python from the command line and it behaves as expected.
I got the same error message when I imported a project of an existing virtual environment to pyCharm. Though the name and path of the exe was correct, pyCharm did not accept it.
My solution was to remove the Interpreter in pyCharm and to add it again. Then the Error was gone. Perhaps that can help someone ...
The EAP (Early Access Program) build Pavel suggests did not work for me. I hope this gets sorted out in PY-33406 as Pavel suggests.
In the responses for that issue, the thing that worked for me is included. I created a virtual environment using venv and was able to use that python interpreter. As it says on that page...
Open the windows prompt
Go to the project root: cd X:\path\to\project
Type python -m venv venv
Chose "existing interpreter" instead of
creating a new venv using Pycharm and pick the Python binary from the
virtualenv you created in the previous step
Hope that helps, happy to update this to add more detail if not.
Remove the interpreter (by using minus sign) and add it again!
In case anyone else is still facing this issue, reinstalling PyCharm did the trick for me.
If you're adding an already existing virtual environment, it may sound dumb but check that the python executable does exist. If it's a symlink, it should point to a valid location in your system.
In my case, I had overwritten the already existing python executable with a new python executable created by clicking the "new" option in the virtual environment creation by mistake, and the result was an incomplete virtual environment setup in which the python executable was a symlink to a non-existing python executable. Recreating the virtual environment from scratch and using it as an "existing" virtual environment solved the issue.
I know these are basic checks, but hopefully this helps someone out there who rushed for an answer.
Try PyCharm 2019.2 EAP build. The problem should be fixed: https://youtrack.jetbrains.com/issue/PY-33406 (or better use Python from python.org).
I reported the typo to PyCharm's bug tracker, thanks https://youtrack.jetbrains.com/issue/PY-36686

PyCharm not recognizing my python interpreter and PIP packages. Maybe PATH issue?

So I have been having issues with getting PyCharm to find my python3 interpreter on my Mac. I have downloaded a few packages with pip from the terminal and when I use the python shell from the terminal and import them, I get no errors.
When I check where these packages are downloaded, I get this path:
/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.>7/lib/python3.7/site-packages
So the issue is when I try to use the PyCharm IDE I don't have access to these packages. I have gone into the settings to change the interpreter and I have tried all these options, none of which show my installed packages.
![1]:https://i.imgur.com/dhTg8CV.png
I have also tried navigating to that path where it shows my packages are downloaded and selecting the python.exe (the highlighted file) I find, but get this error with PyCharm ->
![2]:https://i.imgur.com/DbW5y6I.png
![3]:https://i.imgur.com/B8H4hlA.png
I have a feeling I am selecting the wrong python.exe but I don't know where to look. I also think the problem could stem from me installing iTerm and the zshrc bash program and it changed my paths, but I don't know why python would be working from my terminal then. Just in case, this is what my Path is in my zshrc file:
export PATH=$HOME/bin:/usr/local/bin:$PATH
export PATH="$HOME/.composer/vendor/bin:$PATH"
export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"
Sorry for the long post and no inline images, this is my first post. Any help would be greatly appreciated! Just trying to get this to work so I can work on a project.
Update
just thought it would be useful to know that when i type "which python3" in the terminal it returns -> /usr/local/bin/python3
The simple solution is
Open the pycharm
Go to top left most side on IDE and open FILE dropdown.
Open the project which contains PIP files.
By this procedure pycharm automatic detect the virtual environment.

Anaconda and Spyder won't open if PythonPath is set

I'm new to using Anaconda and Spyder and this must be a simple setting issue, but it's really frustrating. I need to have a PythonPath environment set because I frequently run scripts in ArcGIS which won't work without a path. However, neither Anaconda Navigator nor Spyder will not open if there is a PythonPath set. I get the splash screen, but that's it, it doesn't open. If I remove the PythonPath and reboot, Anaconda and Spyder work, but not ArcGIS. This is not an ArcGIS problem, rather Anaconda and Spyder just don't seem to like there being a PythonPath at all. Anyone have experience with this?
For reference, my PythonPath contains:
C:\Python27;
C:\Python27\Lib;
C:\Python27\Lib\site-packages;
C:\Python27\DLLs;
C:\Python27\Lib\lib-tk;
C:\Python27\scripts;
C:\Python27\ArcGIS10.3\Lib;
C:\Python27\ArcGIS10.3\Lib\lib-tk;
C:\Python27\ArcGIS10.3\Lib\site-packages;
C:\Program Files (x86)\ArcGIS\Desktop10.3\arcpy;
C:\Program Files (x86)\ArcGIS\Desktop10.3\bin
I can remove everything except the bottom five and ArcGIS scripts still work, but it doesn't fix the problem with Spyder. It probably has something to do with the files not actually being executables, but links to scripts. For example, the shortcut for Spyder points to:
C:\ProgramData\Anaconda2\pythonw.exe C:\ProgramData\Anaconda2\cwp.py
C:\ProgramData\Anaconda2 "C:/ProgramData/Anaconda2/pythonw.exe"
"C:/ProgramData/Anaconda2/Scripts/spyder-script.py"
which seems to leave a lot of room for trouble. Interestingly, if I run from the Command Prompt, the first time there are no errors but nothing happens, and the second time it displays:
Spyder is already running. If you want to open a new instance, please
pass to it the --new-instance option
I don't know that I can directly offer a fix, but a nice workaround is spyder's PYTHONPATH manager inside the program. If you open up spyder you should be able to locate the pythonpath manager (on a mac it is under "python" tab) and manually add the necessary paths.
You seem to have relic python installation kicking around and it wasn't uninstalled prior to installing ArcMap. The correct path structure for a clean installation of ArcMap with its associated python would consist of
C:\Python27\ArcGISxx.x
and there are no other files or folders in the C:\Python27 path.
I would suggest uninstalling python completely and do a 'repair' of the arcmap distribution which will reinstall python and its dependencies correctly.
In the interim, you should move the last 3 lines (which refer to arcmap) to the top of the dependency list. That may resolve things temporarily.

Atom IDE autocomplete-python not working

I have just installed the Atom IDE and the package autocomplete-python (on Windows). But the package is not working. Do I have to make any setting changes? (I have disabled autocomplete-plus and autocomplete-snippets).
Do I need to separately install Jedi?
If autocomplete-python in Atom not working with Python 3.7
In windows, go to:
C:\Users\username\.atom\packages\autocomplete-python\lib\jedi\parser
Or in linux:
cd ~/.atom/packages/autocomplete-python/lib/jedi/parser
Duplicate file named "grammar3.6.txt" and change it to "grammar3.7.txt"
It's worked for me with python 3.7!
It worked when I enabled autocomplete-plus. It seems autocomplete-plus is required for autocomplete-python to work. (I had initially followed a youtube video in which autocomplete-plus and -snippets were disabled and then autocomplete-python was installed.)
I was having the same problem, in order to fix it I added python executable path installed package setting and it worked.
"C:\Python27\python.exe;C:\Python27\Scripts\".
In my case I had PyCharm, Anaconda and Python 2.7 was installed on my system and while using atom editior I was not accessing any of the environment, was working on just a plain .py files saved on my desktop.
I was have same problem,
my Atom autocomplete-python not working , I went to:
C:\Users\username\.atom\packages\autocomplete-python\lib\jedi\parser
and because my Python was 3.8 I was created "grammar3.8.txt" too.
Then everything was right And the atom was working properly
Late to the party, but I had the same issue and resolved it by adding a path to my site-packages for one of my virtual environments in the settings.
On the toolbar, go to File-> Settings -> packages.
Find your autocomplete-python package.
Go to the settings of the autocomplete-python package.
Scroll down to "Extra Paths For Packages".
Copy and paste a path location to your site packages.
e.g:
C:\Users\my_username\Miniconda3\envs\my_env_name\Lib\site-packages
Celebrate :)
Same for me. I followed the previous answer but could not find autocomplete-plus (June 2018). I installed autocomplete and now both packages work just fine.
For me, enabling autocomplete-plus didn't help.
It worked when I changed the Python version that I am using from Python 3.7
to Python 3.6.6.
I also had the same problem while trying to use the django-atom autocomplete snippet and after reading different articles on it here is how I go about it.
Go to the directory of the installed autocomplete package, in this case here:
C:\Users\user.atom\packages\django-atom
Go to the snippet folder and you'll find a .cson file, right click and open it with an editor in this case here is the directory:
C:\Users\user.atom\packages\django-atom\snippets
Copy everything inside the file and go back to the snippets.cson file in .atom parent directory, in this case here:
C:\Users\user.atom
Right click and open the snippets file with an editor, scroll down and paste everything you copied earlier into the file then save.
Bro, now you can enjoy your beautiful snippets.

Categories

Resources