Creating conda environment in Docker fails - docker

I am trying to create a conda environment in Docker, which has worked fine in the past. Recently, however, I am met with the following error
Command
conda env create --file /workflow/environment.yml
Error
Pip subprocess error:
ERROR: Invalid requirement: '=' (from line 9 of /workflow/condaenv.8c7h85ns.requirements.txt)
Hint: = is not a valid operator. Did you mean == ?
This is the contents of my environment.yml file
name: pipeline
channels:
- conda-forge
- bioconda
dependencies:
- python=3.7
- pip=20.2.*
- snakemake=5.22.*
- nanoplot=1.31.*
- nanofilt=2.7.*
- nanoqc=0.9.*
- minimap2=2.*
- seqkit=0.13.*
- cutadapt=2.*
- plotly=4.8.*
- spoa=4.*
- seaborn=0.10.*
- edlib>=1.1.2
- natsort=7.1.*
- pip:
- networkx==2.3.*
The only place I'm using pip is in the last line, and I'm already using a double equal-sign. I tried to create the environment outside docker, which worked. I'm not sure where this is going wrong.
I appreciate any help!

Related

installation of OpenCV(cv2) in anaconda3 environment on Ubuntu 20.04 python 3.9.13.final.0

I've been trying to install cv2 on my machine (linux-Ubuntu20.04) with environment manager conda
my python and conda information is pasted below
Conda info:
active environment : base
active env location : /home/anonymous/anaconda3
shell level : 1
user config file : /home/anonymous/.condarc
populated config files : /home/anonymous/.condarc
conda version : 22.9.0
conda-build version : 3.22.0
python version : 3.9.13.final.0
virtual packages : __linux=5.15.0=0
__glibc=2.31=0
__unix=0=0
__archspec=1=x86_64
base environment : /home/anonymous/anaconda3 (writable)
conda av data dir : /home/anonymous/anaconda3/etc/conda
conda av metadata url : None
channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/linux-64
https://repo.anaconda.com/pkgs/r/noarch
package cache : /home/anonymous/anaconda3/pkgs
/home/anonymous/.conda/pkgs
envs directories : /home/anonymous/anaconda3/envs
/home/anonymous/.conda/envs
platform : linux-64
user-agent : conda/22.9.0 requests/2.28.1 CPython/3.9.13 Linux/5.15.0-52-generic ubuntu/20.04.5 glibc/2.31
UID:GID : 1000:1000
netrc file : None
offline mode : False
# conda environments:
#
base * /home/anonymous/anaconda3
sys.version: 3.9.13 (main, Oct 13 2022, 21:15:33)
[G...
sys.prefix: /home/anonymous/anaconda3
sys.executable: /home/anonymous/anaconda3/bin/python
conda location: /home/anonymous/anaconda3/lib/python3.9/site-packages/conda
conda-build: /home/anonymous/anaconda3/bin/conda-build
conda-content-trust: /home/anonymous/anaconda3/bin/conda-content-trust
conda-convert: /home/anonymous/anaconda3/bin/conda-convert
conda-debug: /home/anonymous/anaconda3/bin/conda-debug
conda-develop: /home/anonymous/anaconda3/bin/conda-develop
conda-env: /home/anonymous/anaconda3/bin/conda-env
conda-index: /home/anonymous/anaconda3/bin/conda-index
conda-inspect: /home/anonymous/anaconda3/bin/conda-inspect
conda-metapackage: /home/anonymous/anaconda3/bin/conda-metapackage
conda-pack: /home/anonymous/anaconda3/bin/conda-pack
conda-render: /home/anonymous/anaconda3/bin/conda-render
conda-repo: /home/anonymous/anaconda3/bin/conda-repo
conda-server: /home/anonymous/anaconda3/bin/conda-server
conda-skeleton: /home/anonymous/anaconda3/bin/conda-skeleton
conda-token: /home/anonymous/anaconda3/bin/conda-token
conda-verify: /home/anonymous/anaconda3/bin/conda-verify
user site dirs:
CIO_TEST: <not set>
CONDA_DEFAULT_ENV: base
CONDA_EXE: /home/anonymous/anaconda3/bin/conda
CONDA_PREFIX: /home/anonymous/anaconda3
CONDA_PROMPT_MODIFIER: (base)
CONDA_PYTHON_EXE: /home/anonymous/anaconda3/bin/python
CONDA_ROOT: /home/anonymous/anaconda3
I've been trying several days installing opencv(cv2) on conda base environment with this line of code:
conda install -c conda-forge opencv
conda install -c "conda-forge/label/broken" opencv
conda install -c "conda-forge/label/cf201901" opencv
conda install -c "conda-forge/label/cf202003" opencv
conda install -c "conda-forge/label/gcc7" opencv
i had tried
conda install -c menpo opencv
to but it didn't work for me.
for last try i run this code:
conda install --channel https://conda.anaconda.org/menpo opencv3
and i received this massage:
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: |
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
failed
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:
Specifications:
- opencv3 -> python[version='2.7.*|3.4.*|3.5.*|3.6.*']
Your python: python=3.9
If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.
The following specifications were found to be incompatible with your system:
- feature:/linux-64::__glibc==2.31=0
- feature:|#/linux-64::__glibc==2.31=0
Your installed version is: 2.31
Any help is appreciated.

Private Azure PYPI not reachable in azure pipelines run

I have a project A managed with pipenv that depends on another project B built with pipenv too. The project B is published in the private PYPI. My Pipfile looks like
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[[source]]
url = "https://${USERNAME}:${TOKEN}#MyPrivateRepoUrl"
verify_ssl = true
name = "MyRepoPYPI"
When I install A locally I have not problems and every works fine (declaring environment variables with export command). I have configured an azure-pipelines.yml with 2 jobs, first install A and testing, and the second one is to build and publish the docker image to the ACR. When I trigger the pipeline, the first job fails with this error:
FAIL
[ResolutionFailure]: File "/home/adminroot/.local/lib/python3.7/site-packages/pipenv/resolver.py", line 741, in _main
[ResolutionFailure]: resolve_packages(pre, clear, verbose, system, write, requirements_dir, packages, dev)
[ResolutionFailure]: File "/home/adminroot/.local/lib/python3.7/site-packages/pipenv/resolver.py", line 709, in resolve_packages
[ResolutionFailure]: requirements_dir=requirements_dir,
[ResolutionFailure]: File "/home/adminroot/.local/lib/python3.7/site-packages/pipenv/resolver.py", line 692, in resolve
[ResolutionFailure]: req_dir=requirements_dir
[ResolutionFailure]: File "/home/adminroot/.local/lib/python3.7/site-packages/pipenv/utils.py", line 1403, in resolve_deps
[ResolutionFailure]: req_dir=req_dir,
[ResolutionFailure]: File "/home/adminroot/.local/lib/python3.7/site-packages/pipenv/utils.py", line 1108, in actually_resolve_deps
[ResolutionFailure]: resolver.resolve()
[ResolutionFailure]: File "/home/adminroot/.local/lib/python3.7/site-packages/pipenv/utils.py", line 833, in resolve
[ResolutionFailure]: raise ResolutionFailure(message=str(e))
[pipenv.exceptions.ResolutionFailure]: Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
First try clearing your dependency cache with $ pipenv lock --clear, then try the original command again.
Alternatively, you can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
Hint: try $ pipenv lock --pre if it is a pre-release dependency.
ERROR: Could not find a version that matches pymooslotting (from -r /tmp/pipenvzsh1c47crequirements/pipenv-y37q7d_w-constraints.txt (line 11))
No versions found
Were https://pypi.org/simple or https://MyUsername:***#MyPrivateRepoUrl reachable?
I'm pretty sure the credentials are set correctly.
The amazing thing is that if I run the second job, the docker image is built correctly, therefore it is telling me that the credentials to install B are being passed correctly.
here is the part of the pipelines where I install A
steps:
- task: UsePythonVersion#0
inputs:
versionSpec: '3.7'
architecture: 'x64'
- script: |
python -m pip install --user --upgrade pip
python -m pip install --user pipenv
displayName: Install Pipenv
- script: |
pipenv lock --clear
pipenv install --system
displayName: Install Dev Dependencies
- bash: pytest -rf
displayName: Unit test
I'm not commiting the lock file, but I have done many tests that include the lock in the repo.
Here is the command for docker Publish (that works fine and do the job)
- task: Docker#2
displayName: Build Docker Image
inputs:
command: build
containerRegistry: $(acrRepository)
repository: samples/execslotting
inputs:
tags: |
latest
$(tag)
arguments: '--build-arg USERNAME=$(MyUserName) --build-arg TOKEN=$(MyToken)'
The docker image is installing B, so in the build I pass USERNAME and TOKEN vars.
OBS: The error message No versions found Were https://pypi.org/simple or https://MyUsername:***#MyPrivateRepoUrl reachable? tells me that the envars are correctly read in the execution of the installation job.
the docs specify a different push and pull endpoint urls for pip... Try appending /pypi/simple to the repo description where you are pulling from.
full url: https://<your-feed-name>:<your-PAT-key>#pkgs.dev.azure.com/<your-organization-name>/<your-project-name>/_packaging/<your-feed-name>/pypi/simple/

Build failed while deploying github pages with Hugo and Travis

I am using Travis CI to deploy github pages using latest Hugo version
v0.59.1
however the build fails with the following error.
1.36s$ curl -LO https://github.com/gohugoio/hugo/releases/download/v0.59.1/hugo_0.59.1_Linux-64bit.deb install.2
1.29s$ sudo dpkg -i hugo_0.55.4_Linux-64bit.deb
0.08s$ hugo
Building sites … ERROR 2019/11/11 10:54:14 error: failed to transform
resource: TOCSS: failed to transform "style.scss" (text/x-sass): this
feature is not available in your current Hugo version
Total in 27 ms
Error: Error building site: logged 1 error(s)
The command "hugo" exited with 255.
Below is My .travis.yml
---
install:
- wget -O /tmp/hugo.deb
https://github.com/gohugoio/hugo/releases/download/v0.59.1/hugo_0.59.1_Linux-64bit.deb
- sudo dpkg -i /tmp/hugo.deb
script:
- hugo
deploy:
- provider: script
script: bash deploy.sh
skip_cleanup: true
on:
branch: source
Any suggestions as to how to address this issue? thanks in advance.
For anyone facing similar issue, It worked for me after replacing hugo_extended_0.59.1_Linux-64bit.deb instead of hugo_0.59.1_Linux-64bit.deb

how to run commands separately with tox-travis

I am trying to run lint and tests separately with tox-travis, but I cannot seem to get the right combo.
Here are the two base files:
tox.ini
[tox]
envlist = py27, py34, py35, py36, lint
[travis]
python =
3.6: py36
3.5: py35
3.4: py34
2.7: py27
[travis:env]
LINT =
yes: py36, lint
[testenv:lint]
....
[testenv]
...
commands =
pip install -U pip
py.test --basetemp={envtmpdir}
travis.yml
language: python
python:
- 3.6, lint
- 3.5
- 3.4
- 2.7
matrix:
include:
- python: 3.6
env:
- LINT=yes
install: pip install -U tox-travis
script: tox
When python={3.6,3.5,3.4,2.7} and LINT is not set only tests are
run. (correct).
When python=3.6 and LINT=yes it runs NEITHER lint
or tests. (incorrect)
Setting
LINT =
yes: lint
When python={3.6,3.5,3.4,2.7} and LINT is not set only tests are
run. (correct).
When python=3.6 and LINT=yes it runs neither
tests or lint. (incorrect)
Setting: 3.6: py36,lint and yes: lint runs lint whenever python=3.6 regardless of LINT value.
What am I doing wrong here?

Specifying sets of environmental variables?

According to the manual at travis-ci, if I have in my .travis.yml
env:
- FOO=foo BAR=bar
- FOO=bar BAR=foo
it will trigger two parallel builds:
FOO=foo and BAR=bar
FOO=bar and BAR=foo
Is it possible to have conditional code which only run in one instance, i.e. the first? I have a test which I only want to do for the instance (1) but not two, as it will produce an error in (2)?
My .tavis.yml looks at the moment like this:
Language: objective-c
before_install:
- brew update
install:
- brew tap rkrug/experimental
- brew tap homebrew/science
- brew update
env:
- PACKAGE=nc_spm_08_grass7 INSTALLOPTIONS=""
- PACKAGE=grass-71 INSTALLOPTIONS="--HEAD"
script:
# - brew audit $PACKAGE
- brew install $INSTALLOPTIONS $PACKAGE
- brew test -v $PACKAGE
- brew uninstall $PACKAGE
and the brew audit $PACKAGE I only want to execute for the first instance.
How about using an if condition in Bash to test the $PACKAGE environment variable?
You could replace the commented line in your .travis.yml file with something like:
- if [[ "$PACKAGE" == "nc_spm_08_grass7" ]]; then brew audit $PACKAGE; else echo "[SKIPPED] brew audit $PACKAGE"; fi
Hope this helps!

Resources