r/learnpython • • Jun 02 '23

My Python is having mood swings. I'm thinking of killin git.

Getting real tired of this bullshit. One day all good. Next day "No module called numpy". Okay pip install numpy --> Already there. So ehmm. Whatever. Absolute garbage.

1 Upvotes

25 comments sorted by

51

u/shiftybyte Jun 02 '23

Whatever. Absolute garbage.

I think the mood swings originate elsewhere...

Regarding your python problem, sounds like you either updated python version, or you switched to a different installed version.

17

u/Turbulent-Usual-352 Jun 02 '23

Or have some venvs messed up.

2

u/Hairy-Thought6679 Jun 02 '23

Oooh lemme guess I’m still learning but, did he do what I did and “import numpy as np” but then when he calls the function he calls it as “numpy” not “np”

1

u/Away_Kaleidoscope_96 Jun 02 '23

could be, but if it’s the same code and it ran before then tries again days later or what not, then it’s not likely

2

u/Hairy-Thought6679 Jun 02 '23

I guess I’m assuming he’s modified the code between yesterday and today

28

u/throwaway6560192 Jun 02 '23

Whatever did git do?

26

u/ploud1 Jun 02 '23

Step 1: try doing things that you barely comprehend

Step 2: do not seek advice from more experienced devs who are eager to help

Step 3: everything fails

Step 4: blame it on Python / pip / git / whatever

Sounds like a plan to me, indeed. Joke aside, I understand how frustrating programming can be at times, but ranting on Reddit is not going to take you anywhere. If you share the details of your issue with us, we can help.

10

u/bulaybil Jun 02 '23

PEBKAC.

6

u/threeminutemonta Jun 02 '23

I now never trust the OS path to resolve pip and be specific.

python3.11 -m pip install…

And if you need to use sudo to get around a permission issue you are using a system python. Best to install a python owned by your user or use a venv etc.

5

u/Kerbart Jun 02 '23

This comment needs more upvotes. Issue described by OP is usually when there's multiple instances of Python installed with pip install not being the version you think it is. Using the more explicit my_python -m pip install ... syntax bypasses that problem.

2

u/barrycarter OK to DM me questions/projects, no promises, not always here Jun 02 '23

I hate python too, but try using python -m venv dirname to create a new virtual environment in dirname. Then run the activate program in the bin subdirectory of dirname as appropriate for your shell.

From then on, you'll be using python and pip in that directory, and your installs will go to that directory as well. It's one of the hacks that makes python slightly less sucky

-16

u/Old_Moose2406 Jun 02 '23

Yeah well. Had to go this way. No time to dwell further into this now. It's just... how many times I need to install these freakin modules? Each time I wanna run a script I'll just create a new virtual environment and install them? D:

7

u/barrycarter OK to DM me questions/projects, no promises, not always here Jun 02 '23

You can use the same virtual environment multiple times. The only reason to create another one is if you're switching versions of Python or trying to install conflicting packages or something like that

3

u/coldblade2000 Jun 02 '23

Odds are you're using different python environments. You might be using a venv from your IDE, while the terminal uses your system python environment

3

u/orig_cerberus1746 Jun 02 '23
  • Which OS are you using?

  • Are you using a virtual env of some sort?

  • Which Ide are you using? (If any)

  • How did you install bumpy first?

  • What issue are you having with git?

  • Did you include a virtual env into the git repo? (I recommend you don't)

2

u/[deleted] Jun 02 '23

Sounds venv active on your project but terminal where you do pip install is on a different venv environment.

2

u/MrsCastle Jun 02 '23

You have more than one Python version on your laptop, I’ll bet.

3

u/fauxpas0101 Jun 02 '23

That’s usually been the case for me as well

2

u/alicedu06 Jun 02 '23

As most packaging problems in Python, your suffering is probably due to a flaky Python setup.

Very possibly, your PATH or sys.path is all messed up.

It's very hard to build the knowledge to get you out of trouble because the combinations that can lead you there are numerous.

However, you can start over again in a clean state, and go back to basics:

https://www.bitecode.dev/p/relieving-your-python-packaging-pain

This will make your life less painful in the future.

2

u/Round_Mammoth4458 Jun 03 '23

LackOfDataError ‘Due to lack of supporting code, data or links to a repo “assert is True == UserError: Not following pythonic code.” ‘

Replace User and press any key.

1

u/BlackFlame23 Jun 02 '23

This will happen on a work computer I used to have. It had two different Python versions installed and pip always wanted to put it on the older version. So I always had to make sure to open and run from the older version everything or it would break.

1

u/[deleted] Jun 02 '23

They told you that venv is your friend, right?

Or some handy dandy IDE decided you wanted a new one for every project?

The "Let's See How We Can Make This Harder" crowd comes along to every party.

Keep it simple.

1

u/AssNtittyLover420 Jun 02 '23

Try restarting your computer. Sometimes my new installs get messed up too

1

u/town1d10t Jun 02 '23

"But it works on my machine."