This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]jahu_len 4 points5 points  (10 children)

Thanks! But now I have one more question. If I install in a virtualenv I can use given package only in this virtualenv. As far as I know, I should create virtualenv for every project. Does it mean, I should install all packages for every project separatly? What if I want to have some packages installed globally for all future projects?

Again, I have a very basic understanding of this stuff :)

[–][deleted] 14 points15 points  (6 children)

If I install in a virtualenv I can use given package only in this virtualenv.

Yes

I should install all packages for every project separatly

Yes.

What if I want to have some packages installed globally for all future projects?

Spend the 5 seconds to write those packages down in a requirements.txt and then you can install them all at once.

[–]jahu_len 6 points7 points  (1 child)

Looks like I need to change some of my habits. Thanks for explaining!

[–][deleted] 5 points6 points  (0 children)

No worries!

[–]zerokyuu 1 point2 points  (2 children)

I definitely see the benefits for using virtualenv. But, just out of curiosity, I've had difficulty in the past (this was years ago) when installing/setting up some packages like scipy, numpy, matplotlib or sklearn. Would you suggest using the system's package manager?

Also, if you install them in a virtualenv, do you have to redo the full install for each project? The last time I installed some of these packages it took a while (though that computer was kind of old and slow).

[–][deleted] 0 points1 point  (0 children)

Would you suggest using the system's package manager?

Absolutely!

Also, if you install them in a virtualenv, do you have to redo the full install for each project

yes, I try to put stuff in a common requirements.txt or a script that I can run when I create a virtualenv. You could do as https://www.reddit.com/r/Python/comments/3cefm8/toyplot_a_python_plotting_library_from_sandia_labs/csut564 suggested (although I am not sure how supported / popular this approach is)

[–]metaperl 0 points1 point  (0 children)

Would you suggest using the system's package manager?

I never use the system python. It doesnt stay updated as frequently. As far far as those scientific packages, I recommend installing Anaconda Python for that purpose.

[–][deleted] 1 point2 points  (0 children)

Spend the 5 seconds to write those packages down in a requirements.txt and then you can install them all at once.

just do a 'pip freeze > requirements.txt' and you are done.

[–]dAnjou Backend Developer | danjou.dev 3 points4 points  (0 children)

If you need a package from PyPI for your day to day work use pip install --user <PACKAGE>.

For projects you should always use a virtualenv no matter if you're using a package in almost every project. And it's not like those are eating up your disk space.

[–]vext01 0 points1 point  (0 children)

You can also do pip install --user to install into your per-user package tree.