How do you organize python projects? Do you actually go to the effort of making a virtual environment for every project...

How do you organize python projects? Do you actually go to the effort of making a virtual environment for every project? Seems like way too much effort with swapping between them and downloading all the packages that i use every time. So user, what are your best practices?

Attached: Python.jpg (84x84, 1K)

Of course I fucking do.

So every project you download the same packages? You never install anything into the root environment?

just use a virtual environment tool that symlinks or deduplicates lmfao, no problem then

>Do you actually go to the effort of making a virtual environment for every project
You mean type one command?

my job's software package sets up the python environment, apparently just by sourcing shell scripts and setting up things in the actual environment... so that's how i do my serious projects

for personal stuff or quick scripts, i just use my system's install of python 2.7. and when i need to switch versions i just use the feature of MacPorts:

port select list python

werks for me

How do you do that?

I wouldn't use Python for anything more than a handful of scripts. Certainly not for large projects.

I'm an ML researcher so python is fairly vital. Most of my scripts have the same or similar dependencies so I'm wondering what the most efficient way of creating multiple virtual envs.

literally just vanilla python virtualenv

self taught pleb here

why would I ever want to create a VM for a Python project? Something like C I can get, you don't wanna blow up your system with a typo, but why Python, or anything that isn't very low level?

How is virtualenv too inconvenient, especially with virtualenvwrapper. Make a virtualenv for each project, which allows you to select a particular Python version (useful when it's not your project alone or you have use a package only available on a certain version). Make a requirements.txt or pip freeze >> requirements.txt during your initial commits. Or go ahead and pollute your main site-packages and enjoy dependency hell.

Attached: 1361932082354.jpg (700x473, 40K)

pipenv, OP

But what about if I've got multiple projects with similar dependencies and a lot of them? Is there an easy way to deal with that instead of just downloading them all repeatedly?

Just pip.

>Half-assed but quick and easy mode:
pip freeze > requirements.txt to save a setup
pip install -r requrements.txt to make a new instance

>Funmode
Containerize yo' shit with Docker.

Just use pyenv & pipenv

pipenv keeps a cache in ~/.cache/pipenv/pkg it's not like you'll be downloading everything all the time:

$ ls ~/.cache/pipenv/pkgs/
django-localflavor-br-1.0.tar.gz MarkupSafe-1.0.tar.gz peewee-mssql-0.1.3.tar.gz SQLAlchemy-1.2.10.tar.gz
django-rest-framework-0.1.0.tar.gz peewee-2.10.2.tar.gz pycparser-2.18.tar.gz wrapt-1.10.11.tar.gz
itsdangerous-0.24.tar.gz peewee-3.6.4.tar.gz pylint-plugin-utils-0.4.tar.gz

wondering this as well

we have 1 main project and use anaconda to manage deps and the like, its pretty useful desu

Please tell me this is bait.

>self taught pleb here
well at least you admit it

you probably don't need it if you are fizzbuzzing on your used thinkpad, but if you are working on multiple complex projects, using virtualenv is an absolute must if you don't want to spend hours in dependency hell

Nope, I am using Ruby and Perl, Python is pajeet hipster gayahit

perl... i.e. the spaghetti unreadable language
go home webdev. data scientists expel you from this thread

Looking more into pipenv... To create a second pipenv environment with the same dependencies as the first do I have to go via a requirements.txt file or can I do it straight from a pipfile somehow?

What the fuck? Why would you not use a virtualenv? It takes literally one command to start, one command to install all the packages your project needs with pip.

WTF do you do when you update a library? Break all the dependancies on other projects you have? Absolute brainlet post.

If you ask this you are self-teaching, not self-taught

OP isn't referring to a VM (virtual machine) which is a virtual computing system. Hes referring to a VM, which is a virtual environment that isolates all of your libraries. You use one because each project should have its own libraries and versions.

Say you have 2 projects both using a package. One project needs version 1 of the package, the other needs version 2. To do this you create a virtual environment for each, and download the required package in both environments. Without virtual environments you could only have 1 version of the package installed on your computer and wouldn't be able to build one of your projects.

OP is a brainlet who probably doesn't build anything useful.

Pipenv