Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

micromamba2 can't install pip packages in new environment #3467

Open
3 tasks done
QuLogic opened this issue Sep 26, 2024 · 19 comments
Open
3 tasks done

micromamba2 can't install pip packages in new environment #3467

QuLogic opened this issue Sep 26, 2024 · 19 comments
Assignees

Comments

@QuLogic
Copy link

QuLogic commented Sep 26, 2024

Troubleshooting docs

  • My problem is not solved in the Troubleshooting docs

Anaconda default channels

  • 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

  • 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

@Klaim
Copy link
Member

Klaim commented Sep 26, 2024

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
Copy link
Member

Klaim commented Sep 26, 2024

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?

@depau
Copy link

depau commented Sep 27, 2024

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 :)

@YueeeeeLi
Copy link

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.

@depau
Copy link

depau commented Sep 27, 2024

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

@QuLogic
Copy link
Author

QuLogic commented Sep 27, 2024

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
Copy link
Author

QuLogic commented Sep 28, 2024

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

@maresb
Copy link
Contributor

maresb commented Sep 28, 2024

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 added a commit to maresb/conda-lock that referenced this issue Sep 28, 2024
maresb added a commit to maresb/conda-lock that referenced this issue Sep 28, 2024
maresb added a commit to maresb/conda-lock that referenced this issue Sep 28, 2024
QuLogic added a commit to QuLogic/matplotlib that referenced this issue Sep 30, 2024
Version 2 appears to be broken WRT installing PyPI packages:
mamba-org/mamba#3467
@Klaim
Copy link
Member

Klaim commented Oct 1, 2024

@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
Copy link
Member

Klaim commented Oct 1, 2024

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 Klaim self-assigned this Oct 1, 2024
QuLogic added a commit to QuLogic/matplotlib that referenced this issue Oct 2, 2024
Version 2 appears to be broken WRT installing PyPI packages:
mamba-org/mamba#3467
@Klaim
Copy link
Member

Klaim commented Oct 2, 2024

#3489 might have fixed this issue, please check again with micromamba v2.0.2 when it's out (release planned in a few hours) 🙏🏽

ksunden pushed a commit to matplotlib/matplotlib that referenced this issue Oct 2, 2024
* ci: Bump build image on AppVeyor to MSVC 2019

According to the SciPy toolchain roadmap [1], we should be supporting at
minimum MSVC 2019. The AppVeyor image has been held back to MSVC 2017
(probably just forgotten since it didn't complain), which is starting to
cause issues for more modern code.

[1] https://docs.scipy.org/doc/scipy/dev/toolchain.html

* ci: Pin micromamba on AppVeyor to v1

Version 2 appears to be broken WRT installing PyPI packages:
mamba-org/mamba#3467
maresb added a commit to maresb/conda-lock that referenced this issue Oct 3, 2024
The Windows CI was failing for the unit tests.
Strangely this still worked in conda#713, perhaps due to caching?

<mamba-org/mamba#3467>
@maresb
Copy link
Contributor

maresb commented Oct 3, 2024

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.

@QuLogic
Copy link
Author

QuLogic commented Oct 4, 2024

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

@truh
Copy link

truh commented Oct 9, 2024

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.

kyracho pushed a commit to kyracho/matplotlib that referenced this issue Oct 10, 2024
* ci: Bump build image on AppVeyor to MSVC 2019

According to the SciPy toolchain roadmap [1], we should be supporting at
minimum MSVC 2019. The AppVeyor image has been held back to MSVC 2017
(probably just forgotten since it didn't complain), which is starting to
cause issues for more modern code.

[1] https://docs.scipy.org/doc/scipy/dev/toolchain.html

* ci: Pin micromamba on AppVeyor to v1

Version 2 appears to be broken WRT installing PyPI packages:
mamba-org/mamba#3467
@jeremyleung521
Copy link

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?

@Klaim
Copy link
Member

Klaim commented Oct 14, 2024

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
Copy link
Member

Klaim commented Oct 14, 2024

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

@Klaim
Copy link
Member

Klaim commented Oct 21, 2024

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).

@drammock
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants