radical-collaboration / hpc-workflows

NSF16514 EarthCube Project - Award Number:1639694
5 stars 0 forks source link

Issue with `virtualenv` and `conda` #93

Closed uvaaland closed 5 years ago

uvaaland commented 5 years ago

Hi,

We have made great progress on Tiger and have been able to run some SPECFEM examples. I have been putting together documentation for this and tried to do it all from scratch again.

This is when I ran into an issue that I had seen before, but for some reason did not show up lately. The issue is that of initially creating the virtual environment ve.princeton.tiger if you are already in a conda environment.

In order to run virtualenv from within a conda environment, virtualenv must be installed with conda install virtualenv because pip install virtualenv will give you a version that is incompatible with conda. This becomes an issue when you try to run EnTK the first time, because it tries to set up ve.princeton.tiger with a version of virtualenv that is incompatible with conda. This results in failure, because the virtual environment cannot be created.

The reason why I did not see this lately is because I was running some radical.pilot tests for Andre, where I explicitly set up ve.princeton.tiger as part of the following steps:

$ git clone git@github.com:radical-cybertools/radical.pilot.git
$ cd radical.pilot
$ git checkout feature/tiger
$ ./bin/radical-pilot-ve ve
$ source ve/bin/activate
(ve) $ pip install .
(ve) $ ./bin/radical-pilot-create-static-ve ~/radical.pilot.sandbox/ve.princeton.tiger/
(ve) $ ./examples/09_mpi_units.py princeton.tiger_cpu
(ve) $ ./examples/09_mpi_units.py princeton.tiger_gpu

These steps are not done in a conda environment and work without a problem. Since this creates ve.princeton.tiger, it did not have to be done when I later went back to running EnTK code. And so there was no issue trying to create the virtual environment and EnTK ran successfully.

That is, I know how to get around the issue by explicitly setting up ve.princeton.tiger with the above steps, but this is cumbersome and EnTK should be able to do it on the fly without running into this compatibility issue. The problem is that I don't know how to resolve this virtualenv-conda incompatibility.

andre-merzky commented 5 years ago

@iparask : Ioannis, do you have any input on this, maybe? Thank you!

iparask commented 5 years ago

Hello, I would suggest to create the virtual environment the way that conda does. For example:

$ conda create -n ve python=2.7 -y
$ conda activate ve
(ve)$

That is if you want to use conda at the user level. If conda python is used on the resource level, I would suggest to change the python distribution from the pilot side.

@andre-merzky , changing the python_dist entry in the configuration file to conda instructs the bootstrapper to create a conda environment for the agent. I'm sorry if I'm missing some context and the answer is not complete.