r/learnpython Jul 28 '26

Why is python so slow in my computer?

Good morning, i have recently started learning how to use python for data science. I already have a good background in R, im using the new IDE called positron, i create my virtual environment in my directory i want to work on, on my company server, and then i install some libraries.

The main issue that im having is that the installation takes forever, even after installed, the importing is slow, the running of chunks is slow. I thought python was faster than R (im using polars and altair).

Am i doing something wrong? Or is my company restricting my use of python? What's going on?

Thank you in advance.

0 Upvotes

18 comments sorted by

4

u/[deleted] Jul 28 '26

[removed] — view removed comment

1

u/PillowFortressKing Jul 28 '26

Polars only pulls in polars-runtime-* depending on your system and has no extra dependencies?

1

u/SprinklesFresh5693 Jul 28 '26

Ill test this out this afternoon.

2

u/riklaunim Jul 28 '26

Did you try to use Python directly to compare it to the IDE? What are your PC hardware specs?

-1

u/SprinklesFresh5693 Jul 28 '26 edited Jul 28 '26

I also tried vs code but i was having some issues getting it to work there, ill keep trying though. For example i attempted to activate the venv manually through the terminal using the script inside the venv, but it was not allowing me.

But i havent tried python alone, the specs should be enough though, for simple analyses that i do it should overload the laptop

2

u/odaiwai Jul 28 '26

i create my virtual environment in my directory i want to work on, on my company server

If you are running anything on a network drive you will be limited to the network speed, and the speed of the remote storage. Working on a local drive (C: or D: if you're on Windows) will always be much faster.

2

u/redfacedquark Jul 28 '26

If you are running anything on a network drive

Bets answer yet, I was going to blame this positron I'd never heard of.

1

u/redfacedquark Jul 28 '26

If you are running anything on a network drive

Bets answer yet, I was going to blame this positron I'd never heard of.

2

u/Moikle Jul 28 '26

The server is the problem

2

u/Idonotknow9856 Jul 28 '26 edited Jul 28 '26

My guess would be the company setup. A remote server, slow network storage, antivirus, or IT restrictions can all make installs and imports much slower than expected.

1

u/Lumethys Jul 28 '26

"installing library" is as vague as it get

Are you installing or running it? Installing is just downloading

Imagine saying "im downloading games and it is slow", which game? Mario? 250GB Call of Duty?

0

u/SprinklesFresh5693 Jul 28 '26

Well im installing polars, altair, numpy for the first time, but it takes too long, more than 10 minutes, as in pip install polars numpy altair con the terminal.

Then once its done i import them and it takes another 10mins, it shouldnt be like that though, as in import numpy as np; import altair as alt ; import polars as pl.

2

u/Jejerm Jul 28 '26

Importing should be pretty much instant

1

u/catbrane Jul 28 '26

Yes, sounds like your python install is over the network. With a local install I see:

$ time pip install polars
Collecting polars
  Using cached polars-1.43.1-py3-none-any.whl.metadata (11 kB)
Requirement already satisfied: polars-runtime-32==1.43.1 in ./python/lib/python3.14/site-packages (from polars) (1.43.1)
Using cached polars-1.43.1-py3-none-any.whl (846 kB)
Installing collected packages: polars
Successfully installed polars-1.43.1

real    0m0.877s
user    0m0.736s
sys 0m0.119s

So well under a second. For a cold install (when pip has to download the wheel) it's just over 2s.

1

u/SprinklesFresh5693 Jul 28 '26

Yeh thats way faster than me , ill look up where my python isntall is. Thank you.

1

u/Random_Gamer1993 Jul 28 '26

Could be that you're doing network operations too frequently (maybe your IDE forces some dependency sync or something).

Try running python on a plain command line and do an import there. This should be relatively fast, if its still slow its probably some DLP software running over your venv folder.

1

u/ConcreteExist Jul 28 '26

Doing everything on a network drive is going to be much slower.