https://remoteindian.com/ logo
#random
Title
# random
k

kind-queen-6796

01/31/2021, 6:47 AM
I've been learning python over the weekends just for fun and I really can't figure out how to install a pip package. I keep getting this 'error', would like some help in this regard. I'm following this free tutorial on

youtube

. I tried searching through stackoverflow, but none of the answers seem to help me.
b

bitter-salesclerk-57109

01/31/2021, 6:53 AM
Very stupid suggestion but what’s that $ doing there?
f

faint-energy-11966

01/31/2021, 6:53 AM
Get rid of the `$`in the front. You are not supposed to type that.
Just
pip install openpyxl
k

kind-queen-6796

01/31/2021, 7:14 AM
Removed the
$
, get this now
m

modern-table-48211

01/31/2021, 7:21 AM
So, first some conventions:
$
in front of a command means its supposed to run on a terminal.
#
in front of a command means its supposed to run on a terminal but with root permissions (or use
sudo
but you don't have to put that symbol. Next, you're using Python 2 which is EOL and the package isn't supported. Use
homebrew
and install python 3 https://docs.python-guide.org/starting/install3/osx/ Then use pipenv or virtualenv to create a separate environment & then install what you want
❤️ 1
k

kind-queen-6796

01/31/2021, 7:26 AM
how's that happening? I remember installing python 3.9
m

many-intern-37109

01/31/2021, 7:26 AM
+1 on Virtual environments
k

kind-queen-6796

01/31/2021, 7:26 AM
Hey thanks @modern-table-48211, I'll try doing a clean install
m

many-intern-37109

01/31/2021, 7:28 AM
Btw could you try
pip3 install openpyxl
instead?
k

kind-queen-6796

01/31/2021, 7:28 AM
sure let me do that
@many-intern-37109 you're the man!! 🙌
so I guess I've to replace all
pip install
with
pip3 install
. What exactly is happening here? new version or something?
m

many-intern-37109

01/31/2021, 7:30 AM
Perfect! Next Steps: 1. Create a virtual environment with python3 2.
pip install
will be the default for python3 then
k

kind-queen-6796

01/31/2021, 7:31 AM
Thanks a ton. Btw what's the advantage of creating a virtual environment? Is it really necessary?
m

many-intern-37109

01/31/2021, 7:32 AM
I would recommend to have
zsh
for your terminal. It has cool helpful features
m

modern-table-48211

01/31/2021, 7:32 AM
mac comes with zsh by default.
I don't know how you have python 3, possibly installed by somehwere
but yes, pip3 will use the Python 3 interpreter
👍 1
m

many-intern-37109

01/31/2021, 7:33 AM
Thanks a ton. Btw what’s the advantage of creating a virtual environment? Is it really necessary?
You could have multiple environments for multiple projects. It would decouple the packages and dependencies
m

modern-table-48211

01/31/2021, 7:34 AM
virtual environments help in avoiding conflicting dependencies, esp if you're using multiple projects each having their own specific versions
m

many-intern-37109

01/31/2021, 7:36 AM
Man, last night I had to downgrade from py3.9 to py3.8. The library I was working on wasn’t supported on py3.9
k

kind-queen-6796

01/31/2021, 7:41 AM
Thanks guys, I yet don't have the complete understanding but will read up and try setting a virtual environment first.
b

broad-camera-13514

02/01/2021, 9:12 AM
I'd suggest using a conda env. Far easier to maintain and better support than the virtual env package.