I installed python via brew, and made it my default python. If I run which python, I obtain /usr/local/bin/python. Also pip is installed via brew, which pip returns /usr/local/bin/pip.
I do not remember how I installed ipython, but I didn't do it via brew, since when I type which ipython, I obtain /opt/local/bin/ipython. Is it the OS X version of ipython?
I installed all libraries on this version of ipython, for example I have matplotlib on ipython but not on python. I do not want to re-install everything again on the brew python, rather continue to install libraries on this version of ipython. How can I install new libraries there? For example, Python Image Library, or libjpeg?
If possible, I would like an exhaustive answer so to understand my problem, and not just a quick fix tip.
I installed python via brew, and made it my default python. If I run which python, I obtain /usr/local/bin/python.
Okay, good so far.
Also pip is installed via brew, which pip returns /usr/local/bin/pip.
Actually, not quite brew install python would have installed pip because even doing brew search pip comes up with this warning.
If you meant "pip" precisely:
Homebrew provides pip via: `brew install python`. However you will then
have two Pythons installed on your Mac, so alternatively you can install
pip via the instructions at:
https://pip.readthedocs.io/en/stable/installing/
So, Python came with pip, not brew install
when I type which ipython, I obtain /opt/local/bin/ipython. Is it the OSX version of ipython?
There is no "OSX version of ipython"...
I installed all libraries on this version of ipython, for example I have matplotlib on ipython but not on python.
You actually did install them to your brew installed Python. IPython is not a new installation of Python.
You can even start a python interpreter from the terminal and import matplotlib to check this
I do not want to re-install everything again on the brew python
What exactly needs re-installed? It's already installed into the brew python
To transfer all your packages you can use pip to freeze all of your packages installed in ipython and then install them all easily from the file that you put them in.
pip freeze > requirements.txt
then to install them from the file pip install -r requirements.txt
I'm not entirely sure if I understood what you're asking so if this isn't what you want to do please tell me.
OK, so I solved by uninstalling macport (and so the ipython I was using, which was under /opt/local/bin) and installing ipython via pip. Then I re-install what I needed (e.g. jupyter) via pip.
Related
I installed python 3.8 in a different location than 3.7, and later uninstalled 3.7 while trying to troubleshoot issues with pip. I can't get pip to respond to install any modules now. It keeps referencing its old python 3.7 location and I don't know how to make it focus on the 3.8 installation location.
Here are the errors I'm encountering:
>pip --version
Fatal error in launcher: Unable to create process using '"c:\program files\python37\python.exe" "C:\Program Files\Python37\Scripts\pip.exe" --version': The system cannot find the file specified.
>python get-pip.py
Collecting pip
Using cached pip-20.1.1-py2.py3-none-any.whl (1.5 MB)
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 20.1.1
Uninstalling pip-20.1.1:
Successfully uninstalled pip-20.1.1
Successfully installed pip-20.1.1
Now when I call pip --version is gives me the original error.
And just for more information, here are two more calls which might help troubleshoot.
>which python
/c/Users/patch/AppData/Local/Programs/Python/Python38/python
>python --version
Python 3.8.3
I just want to be able to use pip again to install modules. I'm learning some python and this pip issue is really slowing me down.
I'm open to completely uninstalling python and scrubbing the system of traces of both I just don't know what's the safest and most likely to work option.
Use
python -m pip --version
python -m pip install PACKAGE_NAME
This will use the pip that is associated with the newer python.
I suggest using the python -m pip install command over pip install because it is more clear which python version is being used.
I'd recommend scrubbing 3.7 and 3.8 from your system, then reinstalling the versions you need with pyenv (if you're using the Windows Subsystem for Linux) or pyenv-win (if not on WSL) to manage multiple Python versions. It checks the directory-specific version of Python that you've set before deciding which version's executables to use for Python, pip, etc. This solution will also work in the long term for future versions of Python you may want to install.
Future installations using pyenv or pyenv-win would involve commands like pyenv install 3.8.1. For a full list of available versions you can run pyenv install -l.
#jakub's solution will work if you want an immediate, but short-term, fix.
I am a user without root privileges on a linux multi-user platform. I would like to install matplotlib (I have seen some questions on stackoverflow but they are old and related to previous versions of matplotlib). I think the thing I should do is installing from source python -mpip install .. I cannot find any way to install locally and not globally, as I don't have superuser privilege.
You can take a look here, on stackexchange the problem were solved.
As you can read:
Download the matplotlib and install it manually
install it using pip or easy_install
Manually:
cd /dir/of/your/downloaded/lib
python setup.py install --user
With pip or easy_install:
pip install --user matplotlib
easy_install --prefix=$HOME/.local/ matplotlib
If you have pyenv installed on the system you can easily switch to another python environment that has matplotlib installed.
For example, you can install the latest version of anaconda python, using tab key autocompletion to see which versions are available.
pyenv install anaconda3-5.2.0
Then you can switch your local python version using
pyenv local anaconda3-5.2.0
Now you can check your python version and matplotlib should be available.
On the other hand if pyenv is not currently installed, either ask your admin to install it or use a workaround script as described here.
I am trying to install jupyter on mac,
I understand that the mac comes with python version installed
But i also installed brew and installed python through brew.
When i check python location i get:
which python
/usr/bin/python
When i check pip location i get:
which pip
/usr/local/bin/pip
When i try to install jupyter:
pip install install
after a long installation it tried to remove python package that it want's to upgrade
And fails:
On trying to uninstall dateutil.
I think its the mac packages.
I tried with sudo, no change.
As far as i can understand it because the files are immutable.
Tried to remove the immutable with:
chflags uchg.
No change.
I also tried to work with virtual env, using:
sudo pip install virtualenvwrapper.
But that pip tries to uninstall another python folder.
Any suggestions?
Thanks
UPDATE:
The brew seems to create links from python2. to python2
And the same for python3.
I tried to create the link myself, It worked and i was manage to install the package i wanted. But its not a good solution,
The all point of brew is to manage this things for me, next time i will upgrade python it will break.
Any suggestions why? could it be because the brew installed two python version on my laptop?
RESOLVED:
Found the answer, thanks to #tdube question i went and looked what brew guys did to python and found this thread from Jan 17.
I turns out that they changed the behavior or installing python.
No you don't have simply python any more.
You have python2 and python3.
No more simply pip, now you have pip2 and pip3.
That is a major change from the default behavior of how people use python
Especially that mac comes with a default python
so now you have
python that is /usr/bin/python
python2 that is /usr/local/bin/python2
python3 that is /usr/local/bin/python3
this is the fix, the brew guys suggest ( you can see it when running brew info python ):
==> Caveats
This formula installs a python2 executable to /usr/local/bin.
If you wish to have this formula's python executable in your PATH then add
the following to ~/.zshrc:
export PATH="/usr/local/opt/python/libexec/bin:$PATH"
Pip and setuptools have been installed. To update them
pip2 install --upgrade pip setuptools
You can install Python packages with
pip2 install <package>
They will install into the site-package directory
/usr/local/lib/python2.7/site-packages
See: http://docs.brew.sh/Homebrew-and-Python.html
You can read about it in this thread:
The Python that comes "pre-installed" on Mac is located in /usr/bin/python. I think you need to change the order of the entries in your PATH environment variable as noted here (python homebrew by default). Which file your PATH is set in depends on which shell you are using.
I am using RedHat Linux.
Python 2.6 is already installed in usr/src/bin. When I install Python 2.7, it gets installed in usr/local/src/bin.
Further, I need to install sklearn. When I try installing sklearn using pip, it refers to Python2.6 and not Python2.7.
You can run python -m pip to see if pip is using the right version of python
I think you can probably specify the location with usr/local/src/bin pip install If you're sure that's where python 2.7 is installed. If pip is not using python 2.7 you should reinstall pip in the correct version.
There is another question which could help solve yours:
Pip Install not installing into correct directory?
In my machine learning course we are going to start using theano, a very well known library for deep learning architectures. I all ready installed it with the following command:
$ pip install Theano
By the way, when i want to test if it installed correctly, the python interpreter canĀ“t fin the module. I dont know if im installing it right. Reading the documentation i found anaconda, is it right to first install anaconda and then try to install again with pip theano?. Is this the right way to install this library on MAC OS X?. How can i install this library correctly in order to use theano succesfully?
Installing Python with Homebrew and installing Theano with pip after that worked fine for me. I just needed to install nose after that to be able to run the tests.
brew install python
pip install Theano
pip install nose
I cannot help much installing the framework with Anaconda though.
Anaconda is indeed highly recommended for python libraries. In fact, Anaconda is not only for python in contrast to pip. You can read more here: What is the difference between pip and conda?
For installing Theano, I had already installed Anaconda. I just simply did:
conda install theano
Then, in Ipython, I successfully imported theano:
import theano
Consider installing Theano in a virtual enviroment as oppose to installing it globally via sudo. The significance of this step is nicely described here.
In your terminal window, do the following:
virtualenv --system-site-packages -p python2.7 theano-env
source theano-env/bin/activate
pip install -r https://raw.githubusercontent.com/Lasagne/Lasagne/v0.1/requirements.txt