0

I am trying to create a python virtual environment for Django in ubuntu 20.04 using jenkins execute shell. I have seen a solution here at askubuntu and trying to reproduce this solution but getting the following error in console output:

Running as SYSTEM Building in workspace /var/lib/jenkins/workspace/python_virtual_Env [python_virtual_Env] $ /bin/bash /tmp/jenkins8922469990510149005.sh ModuleNotFoundError: No module named 'virtualenv.seed.embed.via_app_data' /tmp/jenkins8922469990510149005.sh: line 3: cd: virtual_django1/bin: No such file or directory /var/lib/jenkins/workspace/python_virtual_Env /tmp/jenkins8922469990510149005.sh: line 6: activate: No such file or directory Build step 'Execute shell' marked build as failure Finished: FAILURE

Below are my commands which i have used in jenkins execute shell:

#!/bin/bash
virtualenv virtual_django1
cd virtual_django1/bin
pwd
dir
source activate

I have ran the above commands with and without #!/bin/bash but still error persist. How can i get rid off this error in console and get able to create as well activate python virtual environment using jenkins execute shell.

Léa Gris
  • 17,497
  • 4
  • 32
  • 41
eirsh
  • 11
  • 4

1 Answers1

0

I am able to resolve this issue by creating a virtual envirnoment with another command rather than virtualenv. Below is the exact shell commands which will be needed to create and activate the virtual envirnoment for python using jenkins shell:

#!/bin/bash
sudo apt install python3.8-venv
python3 -m venv Virtual_Django
cd my_env/bin
pwd
dir
source activate
ouflak
  • 2,458
  • 10
  • 44
  • 49
eirsh
  • 11
  • 4