Thursday, September 1, 2022

[SOLVED] Use zipped virtualenv

Issue

I'd like to create a virtual environment, zip it up, and execute code using the zipped virtual environment on another machine; it seems to be possible based on href="https://florianwilhelm.info/2016/10/python_udf_in_hive/" rel="nofollow noreferrer">this article.

However, I'm having trouble and sourcing a virtualenv even locally using the technique described in the article.

$ conda create -y -n my_test python=3.5 numpy pandas
$ zip -r env.zip ~/anaconda3/envs/my_test
$ source env.zip/lib/python3.5/venv/scripts/common/activate
-bash: env.zip/lib/python3.5/venv/scripts/common/activate: Not a directory
$ tar cvfhz env.tgz ~/anaconda3/envs/my_test
$ source env.tgz/lib/python3.5/venv/scripts/common/activate
-bash: env.tgz/lib/python3.5/venv/scripts/common/activate: Not a directory

I've tried this on Mac OS X 10.13.6 and Ubuntu 16.04.


Solution

conda create --copy -y -n my_test python=3.5 numpy pandas



Answered By - user993533
Answer Checked By - Katrina (WPSolving Volunteer)