<story><title>Ask HN: How do you handle/maintain local Python environments?</title><text>I&amp;#x27;m having some trouble figuring out how to handle my local Python. I&amp;#x27;m not asking about 2 vs 3 - that ship has sailed - I&amp;#x27;m confused on which binary to be using. From the way I see it, there&amp;#x27;s at least 4 different Pythons I could be using:&lt;p&gt;1 - Python shipped with OS X&amp;#x2F;Ubuntu&lt;p&gt;2 -     brew&amp;#x2F;apt install python&lt;p&gt;3 - Anaconda&lt;p&gt;4 - Getting Python from https:&amp;#x2F;&amp;#x2F;www.python.org&amp;#x2F;downloads&amp;#x2F;&lt;p&gt;And that&amp;#x27;s before getting into how you get numpy et al installed. What&amp;#x27;s the general consensus on which to use? It seems like the OS X default is compiled with Clang while brew&amp;#x27;s version is with GCC. I&amp;#x27;ve been working through this book [1] and found this thread [2]. I really want to make sure I&amp;#x27;m using fast&amp;#x2F;optimized linear algebra libraries, is there an easy way to make sure? I use Python for learning data science&amp;#x2F;bioinformatics, learning MicroPython for embedded, and general automation stuff - is it possible to have one environment that performs well for all of these?&lt;p&gt;[1] https:&amp;#x2F;&amp;#x2F;www.amazon.com&amp;#x2F;Python-Data-Analysis-Wrangling-IPython&amp;#x2F;dp&amp;#x2F;1449319793&lt;p&gt;[2] https:&amp;#x2F;&amp;#x2F;www.reddit.com&amp;#x2F;r&amp;#x2F;Python&amp;#x2F;comments&amp;#x2F;46r8u0&amp;#x2F;numpylinalgsolve_is_6x_faster_on_my_mac_than_on&amp;#x2F;</text></story><parent_chain><item><author>orf</author><text>Not a fan of Conda, the cli is terrible, their unofficial builds are opaque and in my experience the very few packages that are not available on pypi are rarely worth installing (usually the worst kind of &amp;quot;research code&amp;quot;[1]).&lt;p&gt;Simply using pipenv and pyenv is enough for me (brew install pipenv pyenv). You don&amp;#x27;t ever have to think about this, or worry you&amp;#x27;re doing it wrong.&lt;p&gt;Every project has an isolated environment in any python version you want, installed on demand. You get a lockfile for reproducibility (but this can be skipped) and the scripts section of the pipfile is very useful for repetitive commands. It&amp;#x27;s super simple to configure the environment to become active when you move into a project directory.&lt;p&gt;It&amp;#x27;s not all roses, pipenv has some downsides which I hope the new release will fix.&lt;p&gt;When I need a temporary environment to mess around in, then I use virtualfish by running `vf tmp`: &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;virtualfish.readthedocs.io&amp;#x2F;en&amp;#x2F;latest&amp;#x2F;&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;virtualfish.readthedocs.io&amp;#x2F;en&amp;#x2F;latest&amp;#x2F;&lt;/a&gt;&lt;p&gt;1. &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;menpo&amp;#x2F;menpo&amp;#x2F;blob&amp;#x2F;master&amp;#x2F;setup.py#L17&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;menpo&amp;#x2F;menpo&amp;#x2F;blob&amp;#x2F;master&amp;#x2F;setup.py#L17&lt;/a&gt;</text></item></parent_chain><comment><author>xapata</author><text>I have had the opposite experience. Pipenv chose to ignore the use case of developing a package. In the docs, they state they only care about projects that are directly deployed, not installed and used by some other project. Conda helps with both types of projects and handles non-Python dependencies.&lt;p&gt;It takes way too long to make a Pipenv.lock file, and I need to be in the project folder to activate the env?! Terrible user experience.</text></comment>
<story><title>Ask HN: How do you handle/maintain local Python environments?</title><text>I&amp;#x27;m having some trouble figuring out how to handle my local Python. I&amp;#x27;m not asking about 2 vs 3 - that ship has sailed - I&amp;#x27;m confused on which binary to be using. From the way I see it, there&amp;#x27;s at least 4 different Pythons I could be using:&lt;p&gt;1 - Python shipped with OS X&amp;#x2F;Ubuntu&lt;p&gt;2 -     brew&amp;#x2F;apt install python&lt;p&gt;3 - Anaconda&lt;p&gt;4 - Getting Python from https:&amp;#x2F;&amp;#x2F;www.python.org&amp;#x2F;downloads&amp;#x2F;&lt;p&gt;And that&amp;#x27;s before getting into how you get numpy et al installed. What&amp;#x27;s the general consensus on which to use? It seems like the OS X default is compiled with Clang while brew&amp;#x27;s version is with GCC. I&amp;#x27;ve been working through this book [1] and found this thread [2]. I really want to make sure I&amp;#x27;m using fast&amp;#x2F;optimized linear algebra libraries, is there an easy way to make sure? I use Python for learning data science&amp;#x2F;bioinformatics, learning MicroPython for embedded, and general automation stuff - is it possible to have one environment that performs well for all of these?&lt;p&gt;[1] https:&amp;#x2F;&amp;#x2F;www.amazon.com&amp;#x2F;Python-Data-Analysis-Wrangling-IPython&amp;#x2F;dp&amp;#x2F;1449319793&lt;p&gt;[2] https:&amp;#x2F;&amp;#x2F;www.reddit.com&amp;#x2F;r&amp;#x2F;Python&amp;#x2F;comments&amp;#x2F;46r8u0&amp;#x2F;numpylinalgsolve_is_6x_faster_on_my_mac_than_on&amp;#x2F;</text></story><parent_chain><item><author>orf</author><text>Not a fan of Conda, the cli is terrible, their unofficial builds are opaque and in my experience the very few packages that are not available on pypi are rarely worth installing (usually the worst kind of &amp;quot;research code&amp;quot;[1]).&lt;p&gt;Simply using pipenv and pyenv is enough for me (brew install pipenv pyenv). You don&amp;#x27;t ever have to think about this, or worry you&amp;#x27;re doing it wrong.&lt;p&gt;Every project has an isolated environment in any python version you want, installed on demand. You get a lockfile for reproducibility (but this can be skipped) and the scripts section of the pipfile is very useful for repetitive commands. It&amp;#x27;s super simple to configure the environment to become active when you move into a project directory.&lt;p&gt;It&amp;#x27;s not all roses, pipenv has some downsides which I hope the new release will fix.&lt;p&gt;When I need a temporary environment to mess around in, then I use virtualfish by running `vf tmp`: &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;virtualfish.readthedocs.io&amp;#x2F;en&amp;#x2F;latest&amp;#x2F;&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;virtualfish.readthedocs.io&amp;#x2F;en&amp;#x2F;latest&amp;#x2F;&lt;/a&gt;&lt;p&gt;1. &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;menpo&amp;#x2F;menpo&amp;#x2F;blob&amp;#x2F;master&amp;#x2F;setup.py#L17&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;menpo&amp;#x2F;menpo&amp;#x2F;blob&amp;#x2F;master&amp;#x2F;setup.py#L17&lt;/a&gt;</text></item></parent_chain><comment><author>gchamonlive</author><text>+1 for pipenv&lt;p&gt;I develop using pipenv and then deploy installing the dependencies directly in the folder. It works for AWS lambda and containers, although lambda layers are a little more tricky to release:&lt;p&gt;`pipenv lock -r &amp;gt; requirements.txt`&lt;p&gt;`pipenv run pip install -r requirements.txt -t .`</text></comment>