How do I install a missing Python dependency that is already a system package (and detected by pip install)? - macos

I installed Python/pip with Homebrew, then installed Pandas with pip. However, when I import Pandas, it says there is a missing dependency "pytz".
So I run
pip install pytz
But it thinks it already exists
Requirement already satisfied: pytz in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
Removing pytz does not work, when I run pip uninstall pytz, I get permission errors. How should I handle this?

For those interested: I re-installed python/pip with brew again and got this working. Even though Python and pip were in the right directory (/usr/local/bin), Pip was still looking for dependencies in /System. Pip stopped looking in /System after the reinstallation.

Related

unable to load torchaudio even after installing

I'm trying to use torchaudio but I'm unable to import it. I have installed it and it is also visible through the pip list.
<ipython-input-6-4cf0a64f61c0> in <module>
----> 1 import torchaudio
ModuleNotFoundError: No module named 'torchaudio'
pytorch-lightning 1.2.0
torch 1.10.1
torchaudio 0.10.1
torchvision 0.11.2
WARNING: You are using pip version 21.1.2; however, version 21.3.1 is available.
You should consider upgrading via the '/usr/bin/python3 -m pip install --upgrade pip' command.
Since you are using linux and CPU, you should consider uninstalling every pytorch related packages and re-install them via:
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu
as shown here.
I was stuck with the same error. Tried a lot of ways to install and use torchaudio.
This was worked for me (after uninstalling existing torchaudio):
import os
!git clone https://github.com/pytorch/audio.git
os.chdir("audio")
!git checkout 632ea67
!python setup.py install

python module cropresize won't install (PIL dependency doesn't recognize Pillow)

I am trying to install a module (cropresize) for Python3, as required by another module (montage).
pip complains that cropresize (all versions) "depends on PIL."
easy_install, similarly, complains that "no local packages or working download links found for PIL."
Neither pip nor easy_install care that PIL replacement, Pillow, is installed.
To remedy, I installed pillowcase (for "smooth[ing] out installation issues due to the PIL/Pillow fork") but to no avail.
(Attempted install on Python2 failed as well, due to lack of PIL. Pillow is installed there too.)
Any idea what bit of hacking I need to do to get pip or easy_install to install cropresize with Pillow instead of PIL?

How to avoid pip install package again while conda install was done before?

guys:
I use conda install tensorflow-gputo install tensorflow 2.0 , and
numpy=1.20.2 would be one of the package installed, and then I use python3 -m pip install SOMEPACKAGE ,this SOMEPACKAGE needs numpy to be installed as well , but pip seems does not check or realize the package numpy has already installed...
I would like to show everything I know so far :
1.I know the packages installed via conda install would go to anaconda3/envs/YOUR_ENV/lib/site-packages
2.I use python3 -m pip install -t anaconda3/envs/YOUR_ENV/lib/site-packages to force the package would be installed to the place where conda install would be.
However,pip still tries to dwonload *.whl file and install package again,I do not want this package installation process happen again ,while it did mention that I can use --upgrade to replace the existed package...
So I would like to know
How does pip and conda install check if the target package has already existed before they actually to through install process?
I think using python3 you are not using interpreter from your current conda environment so it gets installed elsewhere
python -m pip install (or simply pip install) from your activated environment should work and ignore dependencies installed by conda if they satisfy the requirements

Cannot start qutebrowser, installed packages are shown as missing

I'm trying to install qutebrowser with tox and followed the instructions on this page.
However, this didn't work. When I run
python3 -m qutebrowser
I get one of the error messages
Fatal error: jinja2 is required to run qutebrowser but could not be imported! Maybe it's not installed?
The error encountered was:
No module named 'jinja2'
Please search for the python3 version of jinja2 in your distributions packages, or see https://github.com/qutebrowser/qutebrowser/blob/master/doc/install.asciidoc
If you installed a qutebrowser package for your distribution, please report this as a bug.
or the same with PyYAML/yaml instead of jinja2.
However, if I run
sudo pip install jinja2
sudo pip install pyyaml
I get
Requirement already satisfied: jinja2 in /usr/local/lib/python2.7/dist-packages (2.10.1)
Requirement already satisfied: MarkupSafe>=0.23 in /usr/lib/python2.7/dist-packages (from jinja2) (0.23)
Requirement already satisfied: pyyaml in /usr/local/lib/python2.7/dist-packages (5.1)
I guess the problem may be that the installed versions are for python2.7, however I followed these instructions without change.
You followed those instructions with a change: you run python3 instead of python.
If you have both Python 2.7 and Python 3 installed to install packages for Python 3 you need to run pip3 install or python3 -m pip install.

Using pip to install iPython Notebook

Edit:
According to the pip website (https://pip.pypa.io/en/stable/installing), I should already have pip installed with my Python version 2.9.7, but I assumed that I don't because of the error message.
I then attempted to install pip by downloading get-pip.py. It was successful but I got the messages:
Found existing installation: pip 1.3.1
Uninstalling pip-1.3.1:
Successfully uninstalled pip-1.3.1
Successfully installed pip-8.1.1 wheel-0.29.0
So it seems I did have a version of pip, so I'm not sure why I was getting the error message described in my original post.
But when I tried to then pip install jupyter, I just get:
-bash: pip: command not found
again. Can someone tell me what I'm doing wrong please?
I need to install iPython Notebook. I already have Python (version 2.7.9) installed on my Macbook, running OS X (version 10.7.5).
After some initial investigation, I saw somebody say that I could just run:
pip install "ipython[notebook]"
When I did this however, I got:
-bash: pip: command not found
So do I have to install pip first? And then use pip to install the Notebook? I'm out of my depth and a little confused!
Okay so my problem was that pip was installed, but in a location that was not included in my $PATH variable.
One of the answers here is relevant.

Resources