mamba icon indicating copy to clipboard operation
mamba copied to clipboard

micromamba2 can't install pip packages in new environment

Open QuLogic opened this issue 1 year ago • 19 comments

Troubleshooting docs

  • [X] My problem is not solved in the Troubleshooting docs

Anaconda default channels

  • [X] I do NOT use the Anaconda default channels (pkgs/* etc.)

How did you install Mamba?

Micromamba

Search tried in issue tracker

pip

Latest version of Mamba

  • [X] My problem is not solved with the latest version

Tried in Conda?

I didn't try

Describe your issue

On AppVeyor, we install micromamba manually, then create an environment from environment.yml. This environment is mostly conda-forge, but includes a few packages under a pip key.

Starting today, micromamba successfully creates the environment from the listed packages, but then fails to install the pip-specific packages. I believe micromamba 2.0.0 was released today, so suspect that to be the likely culprit.

mamba info / micromamba info

libmamba version : 2.0.0
    micromamba version : 2.0.0
          curl version : libcurl/8.2.1-DEV Schannel zlib/1.2.13
    libarchive version : libarchive 3.6.2 zlib/1.2.13 liblzma/5.4.3 bz2lib/1.0.8 liblz4/1.9.4 libzstd/1.5.5
      envs directories : C:\Users\appveyor\AppData\Roaming\mamba\envs
         package cache : C:\Users\appveyor\AppData\Roaming\mamba\pkgs
                         C:\Users\appveyor\.mamba\pkgs
                         C:\Users\appveyor\AppData\Roaming\.mamba\pkgs
           environment : base
          env location : C:\Users\appveyor\AppData\Roaming\mamba
     user config files : C:\Users\appveyor\.mambarc
populated config files : C:\Users\appveyor\.condarc
      virtual packages : __win=10.0.17763=0
                         __archspec=1=x86_64
              channels : https://conda.anaconda.org/conda-forge/noarch
                         https://conda.anaconda.org/conda-forge/win-64
      base environment : C:\Users\appveyor\AppData\Roaming\mamba
              platform : win-64

Logs

The full log with --log-level 0 is on this build, but here are the last few lines:

warning  libmamba You are using 'pip' as an additional package manager.
    Be aware that packages installed with 'pip' are managed independently from 'conda-forge' channel.
Installing pip packages: mpl-sphinx-theme~=3.8.0, sphinxcontrib-svg2pdfconverter>=1.1.0, sphinxcontrib-video>=0.2.1, pikepdf
info     libmamba Calling: C:\Users\appveyor\AppData\Roaming\mamba\envs\mpl-dev\python.exe -m pip install -r C:\projects\matplotlib\mambafaglpfkrbx3 --no-input --quiet
'"C:\Users\appveyor\AppData\Roaming\mamba\condabin\micromamba"' is not recognized as an internal or external command,
operable program or batch file.
debug    libmamba Unlocking 'C:\Users\appveyor\AppData\Roaming\mamba\pkgs'
trace    libmamba Removing lock on 'C:\Users\appveyor\AppData\Roaming\mamba\pkgs\pkgs.lock'
trace    libmamba Removing file 'C:\Users\appveyor\AppData\Roaming\mamba\pkgs\pkgs.lock'
critical libmamba pip failed to install packages
Command exited with code 1

environment.yml

https://github.com/matplotlib/matplotlib/blob/main/environment.yml

~/.condarc

No response

QuLogic avatar Sep 26 '24 03:09 QuLogic

Thanks for the report!

I'm trying to reproduce this issue locally on my Windows but cannot so far.

Do you have a link to the real complete log for the build you linked? When I get the supposedly complete log in there it's not actually complete.

Klaim avatar Sep 26 '24 13:09 Klaim

For now my investigation leads me to think something wrong is happening in the environment. If I'm not mistaken, from the log only (as I cant reproduce the issue yet), it seems that the python scripts/packages compilation commands fails because we try to send messages to the python process through it's standard input and it fails for some unclear reason. I dont know much about Appveyor but could it be that some protection happens and prevents the inter-process communication?

Klaim avatar Sep 26 '24 14:09 Klaim

I'm able to reproduce this in the Windows Sandbox:

In a PowerShell window, download micromamba and create a new test prefix:

Invoke-Webrequest -URI https://micro.mamba.pm/api/micromamba/win-64/latest -OutFile micromamba.tar.bz2
tar xf micromamba.tar.bz2
MOVE -Force Library\bin\micromamba.exe micromamba.exe
$Env:MAMBA_ROOT_PREFIX="C:\Users\WDAGUtilityAccount\TestPrefix"
.\micromamba.exe create -c conda-forge -y -n test-prefix --pyc python=3.12

image

Then reproduce the issue by running any command inside the environment:

.\micromamba.exe run -n test-prefix echo "HELLO"

image

It looks like it's failing to create micromamba.bat or something like that in PREFIX_NAME\condabin:

image

I'm able to work around the issue by copying mamba.bat to micromamba.bat

image

I hope this helps :)

depau avatar Sep 27 '24 14:09 depau

We can reproduce a similar error after micromamba self-update:

info     libmamba Opening history file: "C:\\Users\\cenv1007\\micromamba\\envs\\demo\\conda-meta\\history"
debug    libmamba Unlocking 'C:\Users\cenv1007\micromamba\envs\demo\conda-meta'
trace    libmamba Removing lock on 'C:\Users\cenv1007\micromamba\envs\demo\conda-meta\conda-meta.lock'
trace    libmamba Removing file 'C:\Users\cenv1007\micromamba\envs\demo\conda-meta\conda-meta.lock'
warning  libmamba You are using 'pip' as an additional package manager.
    Be aware that packages installed with 'pip' are managed independently from 'conda-forge' channel.

Installing pip packages: -e .
info     libmamba Calling: C:\Users\cenv1007\micromamba\envs\demo\python.exe -m pip install -r C:\Users\cenv1007\cluster-demo\mambaf14ipdgxbkb --no-input --quiet
The system cannot find the path specified.
debug    libmamba Unlocking 'C:\Users\cenv1007\micromamba\pkgs'
trace    libmamba Removing lock on 'C:\Users\cenv1007\micromamba\pkgs\pkgs.lock'
trace    libmamba Removing file 'C:\Users\cenv1007\micromamba\pkgs\pkgs.lock'
critical libmamba pip failed to install packages

The suggested workaround of copying mamba.bat to micromamba.bat (in C:\Users\username\micromamba\condabin in our case) seems to fix the issue - pip packages are now installed.

But the following warning is printed, which we're ignoring for now!

Installing pip packages: -e ., snkit
'chcp' is not recognized as an internal or external command,
operable program or batch file.
'chcp' is not recognized as an internal or external command,
operable program or batch file.

YueeeeeLi avatar Sep 27 '24 16:09 YueeeeeLi

But the following warning is printed, which we're ignoring for now!

Installing pip packages: -e ., snkit
'chcp' is not recognized as an internal or external command,
operable program or batch file.
'chcp' is not recognized as an internal or external command,
operable program or batch file.

I noticed this happens if you add --clean-env to micromamba run

depau avatar Sep 27 '24 16:09 depau

Do you have a link to the real complete log for the build you linked? When I get the supposedly complete log in there it's not actually complete.

Unfortunately not. I managed to get themicromamba info by copying it when it was first printed, but I only get the truncated log now.

I'm able to work around the issue by copying mamba.bat to micromamba.bat

Unfortunately this work around won't work for us as the problem is during creation of the environment, but maybe that'll help find a fix.

QuLogic avatar Sep 27 '24 23:09 QuLogic

Do you have a link to the real complete log for the build you linked? When I get the supposedly complete log in there it's not actually complete.

Unfortunately not. I managed to get themicromamba info by copying it when it was first printed, but I only get the truncated log now.

This build has the full micromamba debug log as an artifact: https://ci.appveyor.com/project/matplotlib/matplotlib/builds/50693281/artifacts

QuLogic avatar Sep 28 '24 01:09 QuLogic

This is occurring in the CI for conda-lock here: https://github.com/conda/conda-lock/actions/runs/11086935473/job/30805084475?pr=713

We are running conda-lock from the Bash shell on Windows, installing from a unified conda-lock.yml lockfile.

The corresponding line in the workflow is here:

micromamba create -y -n gdal-test-mm-lock -f lockfiles/conda-lock.yml

The artifact containing conda-lock.yml is https://github.com/conda/conda-lock/actions/runs/11086935473/artifacts/1991238837 (You can ignore the other two files.)

I hope this helps to reproduce it, thanks so much!!!

maresb avatar Sep 28 '24 21:09 maresb

@depau Your report looks like a different issue? I can't see the whole screenshot for some reason but the errors seems related to file locking, or do you have a more complete log?

Klaim avatar Oct 01 '24 09:10 Klaim

Unfortunately not. I managed to get themicromamba info by copying it when it was first printed, but I only get the truncated log now.

This build has the full micromamba debug log as an artifact: https://ci.appveyor.com/project/matplotlib/matplotlib/builds/50693281/artifacts

For some reason the file link sends you an mp3 😆 renaming the file extension to txt solves this but that's weird

Klaim avatar Oct 01 '24 09:10 Klaim

https://github.com/mamba-org/mamba/pull/3489 might have fixed this issue, please check again with micromamba v2.0.2 when it's out (release planned in a few hours) 🙏🏽

Klaim avatar Oct 02 '24 15:10 Klaim

~For people hitting this in GHA via setup-micromamba, this appears to be fixed, at least in my case, by upgrading the workflow to use @v2 of setup-micromamba.~

Apologies, I was conflating this with a different problem that presented similarly.

maresb avatar Oct 03 '24 19:10 maresb

Unfortunately, 2.0.2 has not fixed this error: https://ci.appveyor.com/project/matplotlib/matplotlib/builds/50730536

QuLogic avatar Oct 04 '24 06:10 QuLogic

Had the same problem in my Windows CircleCI build step. Changed the CI to install micromamba 1.5.10 as a workaround which was a bit tricky since the VERSION feature in the install powershell script is broken and downgrading micromamba with micromamba self-update --version 1.5.10 didn't work either.

truh avatar Oct 09 '24 08:10 truh

Hi @Klaim, is there any activity regarding fixing this? It's unfortunate that it's not been working for more than 2 weeks now. Are you having trouble reproducing?

jeremyleung521 avatar Oct 11 '24 14:10 jeremyleung521

Hi @Klaim, is there any activity regarding fixing this? It's unfortunate that it's not been working for more than 2 weeks now. Are you having trouble reproducing?

Indeed, I still cannot reproduce it on my side (I was also away for some days last week so that doesnt help). We expected 2.0.2 to fix the issue as we saw similar issues in some CI reports and these are fixed by that version. Sorry that it takes time, this release brought a lot of issues so we are a bit swamped, but we are still looking into it.

Klaim avatar Oct 14 '24 08:10 Klaim

We managed to reproduce the issue on my local machine, potential solution in progress.

Klaim avatar Oct 14 '24 10:10 Klaim

We expect these changes to fix this issue: https://github.com/mamba-org/mamba/pull/3546 But we'll need feedback from you all to be sure (once it's made available in a release).

Klaim avatar Oct 21 '24 13:10 Klaim

We expect these changes to fix this issue: #3546 But we'll need feedback from you all to be sure (once it's made available in a release).

any word on when such a release might happen? Or is there a source for nightlies of the setup-micromamba action that I could try, that would pull in that fix?

drammock avatar Oct 24 '24 16:10 drammock

We expect these changes to fix this issue: #3546 But we'll need feedback from you all to be sure (once it's made available in a release).

any word on when such a release might happen? Or is there a source for nightlies of the setup-micromamba action that I could try, that would pull in that fix?

In case you didnt already found out, the fixes were published in 2.0.3 but that version was marked broken because of other issues (#3576 in particular) but if you want to try them we are publishing alpha version of 2.0.4 to fix these issues before publishing a stable version.

Klaim avatar Nov 14 '24 13:11 Klaim

micromamba 2.0.4alpha3 has been released on conda-forge on the micromamba_prerelease label.

It is installable with:

micromamba install conda-forge/label/micromamba_prerelease::micromamba==2.0.4alpha3                                                                                                         

Can you try this version and see whether it resolved the problem? Thank you.

jjerphan avatar Nov 21 '24 16:11 jjerphan

I gave this a shot and it appears to have worked: https://ci.appveyor.com/project/matplotlib/matplotlib/builds/51036556

QuLogic avatar Nov 22 '24 03:11 QuLogic

This should has been fixed by 2.0.4 which is being released. Please do respond to this issue, if you still meet this issue.

jjerphan avatar Nov 25 '24 08:11 jjerphan