When prompting which python in the terminal I get /opt/anaconda3/bin/python and with python --version I get that Python 3.8.3, so in the path /opt/anaconda3/bin/python the version installed is 3.8.3 and if I run pip install any module in the terminal I assume that this module will be installed in said directory.
When working in PyCharm per default the Python interpreter that is used is version 2.7 and when I try to change the base interpreter in the virtual env in the settings of PyCharm the path /opt/anaconda3/bin/python won't appear. How can I use the python version and the modules installed from /opt/anaconda3/bin/python in PyCharm?
Related
I am getting an error when trying to run pip through Spyder 5.0.3
I have recently installed Spyder 5.0.3 on my machine from https://www.spyder-ide.org/
When I attempt to exectute "pip --version" on IPython in Spyder I get the following error message:
Note: you may need to restart the kernel to use updated packages.
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
How do I fix this so I can run pip in IPython Spyder?
The standalone installer for Windows available in the Spyder website doesn't have pip in it. If you want to use or install a specific package outside of the ones that are shipped with the standalone installer you will need to go with the modular approach to use Spyder (create an environment and select his python executable as the interpreter that Spyder will use).
For that you will need to:
Install a python distribution as for example miniforge: https://github.com/conda-forge/miniforge/tree/4.10.1-3#download
Create a new python environment, install spyder-kernels and the packages you want to use in it.
Set the Spyder interpreter preference to point to the environment created.
The Spyder GitHub wiki has a page that explains the process to setup some of this elements: https://github.com/spyder-ide/spyder/wiki/Working-with-packages-and-environments-in-Spyder#the-modular-approach
I downloaded and installed Anaconda3-2019.03-MacOSX-x86_64.pkg which should normally install python 3.7. But oddly this is not the case :
(base) iMac-de-Bibi:~ ac$ which python
/Users/ac/anaconda3/bin/python
(base) iMac-de-Bibi:~ ac$ /Users/ac/anaconda3/bin/python --version
Python 2.7.16 :: Anaconda, Inc
Any help would be appreciated
Note : it's my first anaconda installation on this machine
You might have mistakenly downloaded and installed the wrong Anaconda distribution.
You might have changed the Python version in the base environment after the initial installation, by doing something like this:
conda activate base
conda install python=2.7
Update: As reported in a comment, installing pyside downgrades Python.
Have you correctly activated the base environment, and not messed with PATH or PYTHONPATH? I'm not sure about it, but python might be a script that calls the actual Python interpreter. It could pick the wrong one if search paths are off.
In general, I recommend to install Miniconda and create custom environments. Then you can choose whichever Python version you want for each environment, and don't care which one is in the base environment.
As a Python beginner, I installed Python 3 via Anaconda, and have successfully installed it in my Mac laptop. I have no problem to use Python 3 if I launch Jupyter notebook, but I cannot locate it in the terminal.
Specifically, if is type in:
$ which python
I got the feedback of
/usr/bin/python
but if I type in
$ which python3
There is no feedback at all. Just curious if I have missed anything.
When you install a new environment with Anaconda with a specific version of Python, that version of Python will be accessible only if you activate the Anaconda's environment.
If you want to access to your python 3 of your environnement from the terminal, you need to activate it :
source activate my_env
Then you can write "which python3"
For example, on my computer, you can see two different versions of Python depending on the environnement I use or the version installed on my Mac.
// On my mac
which python3
>> /Users/michaelcaraccio/anaconda/bin/python3
Then when I activate the env :
which python3
>> /Users/michaelcaraccio/anaconda/envs/TM/bin/python3
If you need more information, don't hesitate to ask :)
I want to install the python-igraph package, but I am currently using python 3.6.1 and I don't find any installer for this new version of python. Do you know how can I install python-igraph for this version?
I have tried to install python-igraph for older versions from anaconda cloud but a version problem occurs.
!conda install -c vtraag python-igraph
Fetching package metadata .............
Solving package specifications: .
UnsatisfiableError: The following specifications were found to be in conflict:
- python 3.6*
- python-igraph -> python 3.5*
Use "conda info <package>" to see the dependencies for each package.`
I know that python-igraph exists for older python versions, but I don't want to overwrite the current python 3.6 version, so I think I need a new environment to install the older version and be able to use both.
I have already tried to create a new environment for python 3.5:
!conda create -n py35 python=3.5 ipykernel
But after 30min I didn't obtain any response...
I have also followed the same procedure to install a package for python 2.7 (from marufr contributor), but I get the same problem creating an environment for python 2.7.
Note: I am working from Jupyter notebook on Windows (win-64) and using Anaconda.
Update:
Solution found here:
https://medium.com/towards-data-science/environment-management-with-conda-python-2-3-b9961a8a5097
Since there is no python-igraph for python 3.6 yet, I have to use an older version.
First, from Anaconda Prompt, install the nb_conda_kernels package before creating the new environment:
conda install nb_conda_kernels
Then, create the environment where I will work with the older python version:
conda create -n py35 python=3.5 ipykernel
Finally, install the package through the wheel (found here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#python-igraph)
pip install python_igraph‑0.7.1.post6‑cp35‑none‑win_amd64.whl (You have to this command in the same folder that you donwloaded the wheel!)
There is a Windows installer for igraph‘s Python interface on the Python Package Index. Download the one that is suitable for your Python version (currently there are binary packages for Python 2.6, Python 2.7 and Python 3.2, though it might change in the future). To test the installed package, launch your favourite Python IDE and type the following:
import igraph.test
igraph.test.run_tests()
The above commands run the bundled test cases to ensure that everything is fine with your igraph installation.
Now, you can download 'python_geohash‑0.8.5‑cp36‑cp36m‑win_amd64.whl'.
Use the following command to install:
pip install python_geohash‑0.8.5‑cp36‑cp36m‑win_amd64.whl
Then you can use python-igraph in your Python3.6
My question is thoroughly based on this question. The big difference is I'm focusing on windows here. The answers/question provided there were for unix distributions.
I've ran Python 2.x for quite a while and have used pip with no problems.
Now I've installed python 3 but when I open the cmd prompt and pip install somemodule it tries to install it for python 2. How can I deal with this situation ?
Both Python's were installed with the Anaconda distribution so I believe both of them come with pip installed. Note: This info come from this question
EDIT:
Found this answer which addresses that issue.
But now when I try to run the command
pip3.5 install pymssql
or
pip-3.5 install pymssql
I get the error pip3.5 is an unknown command.
If I open cmd and type python I receive:
Python 3.5.1 Anaconda 4.0.0
so it shouldn't be a version problem
You will want to make sure you have the correct Anaconda environment activated, which it looks like you have in this case.
conda env list # Display the list of conda environments
In the Windows Command Prompt you should just need to use:
activate py35 # Or whatever your Python 3.5 environment is called. (Mine is root)
pip install pymssql
Instead of pip-3.5.
To install it in another environment (mine is called py27):
activate py27
pip install pymssql
I successfully used this command in both my Python 2.7 and 3.5 Anaconda environments.
To go back to your primary environment (root), just type activate without an environment name after it