Closed brianbrownton closed 4 years ago
Did you get any error messages when running pip3 install psutil
and what's the output when you run python3 -c "import psutil"
?
[~]$ pip3 install psutil
Processing ./Library/Caches/pip/wheels/b6/e7/50/aee9cc966163d74430f13f208171dee22f11efa4a4a826661c/psutil-5.7.0-cp37-cp37m-macosx_10_15_x86_64.whl
Installing collected packages: psutil
Successfully installed psutil-5.7.0
[~]$ python3 -c "import psutil"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'psutil'
Huh. Would you mind also posting the output from python3 -m pip install psutil
Also which python3
and which pip3
.
Did you have a python3 installation before installing with brew?
[~]$ python3 -m pip install psutil
Collecting psutil
Using cached https://files.pythonhosted.org/packages/c4/b8/3512f0e93e0db23a71d82485ba256071ebef99b227351f0f5540f744af41/psutil-5.7.0.tar.gz
Building wheels for collected packages: psutil
Building wheel for psutil (setup.py) ... done
Stored in directory: /Users/brian/Library/Caches/pip/wheels/d7/69/b4/3200b95828d1f0ddb3cb5699083717f4fdbd9b4223d0644c57
Successfully built psutil
Installing collected packages: psutil
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Python/3.7'
Consider using the `--user` option or check the permissions.
You are using pip version 19.0.3, however version 20.2b1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[~]$ which python3
/usr/bin/python3
[~]$ which pip3
/usr/local/bin/pip3
I do not recall installing python3 (via homebrew or other means), but I believe it is now a dependency of homebrew's php or something.
It gets weirder though...
$ brew info python3
python: stable 3.7.7 (bottled), HEAD
Interpreted, interactive, object-oriented programming language
https://www.python.org/
/usr/local/Cellar/python/3.7.7 (4,046 files, 61.9MB)
Poured from bottle on 2020-03-11 at 10:57:08
and then...
[~]$ python3 --version
Python 3.7.3
So it seems it is using system python3 not the homebrew version
I would suggest uninstalling one of the python3 installs you've got and if you keep the non homebrew one; install psutil with sudo python3 -m pip install psutil
, should fix the "permission denied" error you got.
@aristocratos this may interest you: https://docs.brew.sh/Homebrew-and-Python
How so?
The install instructions in the readme assumes you haven't already installed python3. Python 2.7 comes installed with OsX until 10.6 when it will be replaced with python3. So unless you have not manually installed python3 there are no issues.
But I can add a notice to check if python3 is already installed.
I'm just trying to help, friend.
I did not explicitly install python (of any version, outside your install instructions), but somehow I ended up in this mess... so it stands to reason that others may also have these troubles but just not report them. Do with that information as you wish.
I'm just trying to help, friend.
And you did, by opening this issue. Anybody else having problems will hopefully find it if they search for "macos install".
I did not explicitly install python (of any version, outside your install instructions)
Yet you had python3 already installed and it doesn't come preinstalled.
Ergo:
But I can add a notice to check if python3 is already installed.
Should fix the issue before it arises for anybody else.
I personally don't appreciate you being argumentative/pedantic while I'm trying to help your project. Open source (and all development, really) works best with a dose of kindness and understanding.
Yet you had python3 already installed and it doesn't come preinstalled.
As I said, it was a dependency of another formula. If you think this is some kind of rare situation, I invite you to run
brew deps --all | grep python
I'm not trying to be argumentative, but I think your presumption that python3 was installed by another brew formula is wrong. Since it it was installed in /usr/bin:
[~]$ which python3 /usr/bin/python3
Had it already been installed by brew it would have been located in /usr/local/bin and there wouldn't have been a path conflict.
And this particular issue can only happen if you have installed python3 outside of brew, otherwise brew would see the dependency as met and not install another one.
[...]
Python has been installed as
/usr/local/opt/python@3.8/bin/python3
You can install Python packages with
/usr/local/opt/python@3.8/bin/pip3 install <package>
They will install into the site-package directory
/usr/local/opt/python@3.8/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages
See: https://docs.brew.sh/Homebrew-and-Python
==> Summary
🍺 /usr/local/Cellar/python@3.8/3.8.3_1: 4,125 files, 63MB
$ which python
/usr/bin/python
$ python --version
Python 2.7.16
$ which python3
/usr/bin/python3
$ python3 --version
Python 3.7.3
And my presumption about it being installed as a dependency previously was not wrong - if you ran the deps command I provided earlier, or trusted what I said days ago:
I do not recall installing python3 (via homebrew or other means), but I believe it is now a dependency of homebrew's php or something.
You would find that for some reason, python is a dependency currently of php (along with glances and a few other things I have installed it seems).
$ brew deps php
apr
apr-util
argon2
aspell
autoconf
brotli
c-ares
curl-openssl
freetds
freetype
gdbm
gettext
glib
gmp
icu4c
jansson
jemalloc
jpeg
krb5
libev
libevent
libffi
libidn
libmetalink
libpng
libpq
libsodium
libssh2
libtiff
libtool
libzip
nghttp2
oniguruma
openldap
openssl@1.1
pcre
python@3.8
readline
rtmpdump
sqlite
tidy-html5
unixodbc
webp
xz
The way homebrew treats formula also change over time (for example they stopped supporting python2 for EOL at the end of 2019) so people that didn't start with a fresh system and then just try to install bashtop may have a homebrew situation which can be difficult to reproduce or troubleshoot - which is why I linked the article on homebrew and python for you ( https://docs.brew.sh/Homebrew-and-Python ).
Had it already been installed by brew it would have been located in /usr/local/bin and there wouldn't have been a path conflict.
~I think I have just shown this to be false~ - homebrew will not overwrite the system python path and instead installs it into /usr/local/opt/python@3.8/bin/python3
and leaves the user to deal with $PATH issues.
edit: they are symlinked in /usr/local/bin
$ ls /usr/local/bin/python*
lrwxr-xr-x 1 brian admin 40B 8 Jul 11:34 /usr/local/bin/python3 -> ../Cellar/python@3.8/3.8.3_1/bin/python3
lrwxr-xr-x 1 brian admin 47B 8 Jul 11:34 /usr/local/bin/python3-config -> ../Cellar/python@3.8/3.8.3_1/bin/python3-config
lrwxr-xr-x 1 brian admin 42B 8 Jul 11:34 /usr/local/bin/python3.8 -> ../Cellar/python@3.8/3.8.3_1/bin/python3.8
lrwxr-xr-x 1 brian admin 49B 8 Jul 11:34 /usr/local/bin/python3.8-config -> ../Cellar/python@3.8/3.8.3_1/bin/python3.8-config
but this is my $PATH:
$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/flutter/bin
which is why this isn't working i imagine
Kinda was what I was trying to say. The brew installed version is not a problem here. Since the python3 in /usr/bin didn't have pip installed, pip3 from /usr/local/bin got called and installed psutil for the brew python3 version, but when you launch /usr/bin/python3 psutil is missing because it never got psutil installed.
So should these instructions be changed?
brew install bash coreutils gnu-sed python3 git
pip3 install psutil
the pip3 will go for system pip3, so do we need to do something like python3 -m pip install psutil
?
Success!
[~]$ python3 -m pip install psutil
Collecting psutil
Using cached psutil-5.7.0.tar.gz (449 kB)
Building wheels for collected packages: psutil
Building wheel for psutil (setup.py) ... done
Created wheel for psutil: filename=psutil-5.7.0-cp38-cp38-macosx_10_15_x86_64.whl size=226935 sha256=a4f149d3ee9f179c400bc0daeeb747d4253ba5c06e8e4c1734e9d0bbe229dd29
Stored in directory: /Users/brian/Library/Caches/pip/wheels/90/c9/b6/04665702b01dbd9ee92a05e834b627948ed01cdd482e6a78e1
Successfully built psutil
Installing collected packages: psutil
Successfully installed psutil-5.7.0
[~]$ python3 -c "import psutil"
[~]$ bashtop
That's what I meant with:
But I can add a notice to check if python3 is already installed.
I can add additional instructions for non brew python3 if that's needed.
python3 -m ensurepip
python3 -m pip install psutil
python3 -m ensurepip
installs pip if it's missing.
the pip3 will go for system pip3, so do we need to do something like python3 -m pip install psutil?
Brew installs pip with python3 by default.
But python3 downloaded from python.org will not have pip.
Brew installs pip with python3 by default.
yes, but it's the "wrong" one at least for me
[~]$ which pip
pip not found
[~]$ which pip3
/usr/bin/pip3
[~]$ ls $(which pip3)
-rwxr-xr-x 1 root wheel 31K 19 May 01:32 /usr/bin/pip3
[~]$ pip3 --version
pip 19.0.3 from /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/pip (python 3.7)
so you can see that is system pip3 when called (even with home brew installed and /usr/local declared first in path)
I would guess you installed it inadvertently or not while testing since this is the output you gave 12 days ago:
[~]$ which python3
/usr/bin/python3
[~]$ which pip3
/usr/local/bin/pip3
As long as both which pip3
and which python3
finds them in the same directory all should be good even if it's not using the brew installed ones.
so you can see that is system pip3 when called (even with home brew installed and /usr/local declared first in path)
That's weird though, it should search the paths in order...
Try type python3
and type pip3
and see if you get same result.
You can also use type -a python3
and type -a pip3
should give all versions installed.
Python 3.8.3_2 came out today on brew and upgrading the formula now gives me this:
[~]$ type -a python3
python3 is /usr/local/bin/python3
python3 is /usr/bin/python3
[~]$ type -a pip3
pip3 is /usr/local/bin/pip3
pip3 is /usr/bin/pip3
So i don't really know why sometimes the install/reinstall wasn't dropping a symlink for pip3 into /usr/local/bin but it seems to be now 🤷♂️
Describe the bug
To Reproduce
Follow macOS (OSX) install directions, including python3 and pip3 install psutil.
Expected behavior
bashtop runs
Info (please complete the following information):
master
GNU bash, version 5.0.17(1)-release (x86_64-apple-darwin19.4.0)
(
-v
flag throws an error on macOS fyi)Additional context
no error log present, this is a vanilla clone/install
config contents: