Mads M Pedersen
Mads M Pedersen

Reputation: 613

Gitlab CI runner running python and numpy 1.18 from anaconda envirronment

For gitlab ci jobs I have previously run test scripts via python like this

- c:\anaconda3\env\my_env\python test.py

With numpy 1.18, however, activating the envirronment is required, otherwise it fails to import

I have tried via conda run:

 - c:\anaconda3\scripts\conda run -n my_env -v python test.py

but then all output is swallowed (not shown in the job output).

I have also tried several ways and combinations of activate and python test.py with both cmd and powershell, but I have not found a way that activates the envirronment and runs the script with python from that envirronment.

Upvotes: 0

Views: 274

Answers (1)

Mads M Pedersen
Mads M Pedersen

Reputation: 613

I solved the problem by using the git bash instead of powershell

  • add C:\Program Files\Git\bin to the system PATH-variable
  • add to c:\\[gitlab_runner_dir]/config.toml

    shell = "bash"
    builds_dir="/c/gitlab-runner/builds/"
    cache_dir="/c/gitlab-runner/cache/"
    
  • in .gitlab-ci.yml add:

    - source activate my_env
    

Upvotes: 1

Related Questions