3

I use pyrobuf (a protobuf package) in Python 3. In order to use a proto-pattern you run pyrobuf <filename> --install which will compile the pattern and copy it to the site-packages folder from where you can import it.

I'm trying to do this via a script (which is quite straight forward). However I ran into a problem when trying to run pyrobuf inside a virtual environment.

I have somethin like this:

cmd = ['activate', <envname>, '&&', 'pyrobuf', <filename>, '--install', '&&', 'deactivate']
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

When run this installs the proto-pattern to my main anaconda install not to the (supposedly active) environment.

I'm installing pyrobuf to each individual environment but that doens't seem to make a difference.

Any help on how to run a programm 'inside a conda environment' is greatly appreciated.

orangeInk
  • 1,360
  • 8
  • 16
  • I am able to run scripts inside of an unactivated conda env by running: "/path/to/anaconda/envs/env_name/bin/python filename.py". Are you trying to activate the environment programmatically as well? – ally-e Aug 01 '17 at 14:57
  • Following stackoverflow answer might work https://stackoverflow.com/a/72395091/1155185 – Dan M Aug 22 '22 at 17:34

0 Answers0