TRIQS / triqs

a Toolbox for Research on Interacting Quantum Systems
https://triqs.github.io
GNU General Public License v3.0
135 stars 71 forks source link

Triqs/Jupyter installation order using Anaconda on MacOS #922

Closed Crampon16 closed 10 months ago

Crampon16 commented 10 months ago

I am using minconda3 to install triqs on a MacBook. Installing triqs first prevents later installation of Jupyter. The other way around works fine.

Steps to Reproduce

  1. Download conda. I used [https://docs.conda.io/projects/miniconda/en/latest/]
  2. conda install -c conda-forge triqs
  3. conda install jupyter

Expected behavior: I can run jupyter notebook and import triqs inside.

Actual behavior: I get the following error message:

(base) liam.rampon@ ~ % conda install jupyter
Error while loading conda entry point: conda-libmamba-solver (dlopen(/Users/liam.rampon/miniconda3/lib/python3.11/site-packages/libmambapy/bindings.cpython-311-darwin.so, 0x0002): Library not loaded: @rpath/libarchive.19.dylib
  Referenced from: <02C528AB-0A0D-32BE-8F88-DB5C6474982C> /Users/liam.rampon/miniconda3/lib/libmamba.2.0.0.dylib
  Reason: tried: '/Users/liam.rampon/miniconda3/lib/libarchive.19.dylib' (no such file), '/Users/liam.rampon/miniconda3/lib/python3.11/site-packages/libmambapy/../../../libarchive.19.dylib' (no such file), '/Users/liam.rampon/miniconda3/lib/python3.11/site-packages/libmambapy/../../../libarchive.19.dylib' (no such file), '/Users/liam.rampon/miniconda3/bin/../lib/libarchive.19.dylib' (no such file), '/Users/liam.rampon/miniconda3/bin/../lib/libarchive.19.dylib' (no such file), '/usr/local/lib/libarchive.19.dylib' (no such file), '/usr/lib/libarchive.19.dylib' (no such file, not in dyld cache))
Collecting package metadata (current_repodata.json): done
Solving environment: unsuccessful initial attempt using frozen solve. Retrying with flexible solve.
Solving environment: unsuccessful attempt using repodata from current_repodata.json, retrying with next repodata source.

ResolvePackageNotFound: 
  - conda==23.5.2

Versions

Latest triqs version I suppose ? I am running this on a completely clean (nothing except triqs has been installed yet) M1 MacBook Air Sonoma. I got a similar issue on an Intel MacBook Pro running MacOS Sierra then Big Sur.

Additional Information

In the case I described but also when installing jupyter first then triqs (which successfully installs both), any later call to conda will display the error message

Error while loading conda entry point: conda-libmamba-solver (dlopen(/Users/liam.rampon/miniconda3/lib/python3.11/site-packages/libmambapy/bindings.cpython-311-darwin.so, 0x0002): Library not loaded: @rpath/libarchive.19.dylib
  Referenced from: <02C528AB-0A0D-32BE-8F88-DB5C6474982C> /Users/liam.rampon/miniconda3/lib/libmamba.2.0.0.dylib
  Reason: tried: '/Users/liam.rampon/miniconda3/lib/libarchive.19.dylib' (no such file), '/Users/liam.rampon/miniconda3/lib/python3.11/site-packages/libmambapy/../../../libarchive.19.dylib' (no such file), '/Users/liam.rampon/miniconda3/lib/python3.11/site-packages/libmambapy/../../../libarchive.19.dylib' (no such file), '/Users/liam.rampon/miniconda3/bin/../lib/libarchive.19.dylib' (no such file), '/Users/liam.rampon/miniconda3/bin/../lib/libarchive.19.dylib' (no such file), '/usr/local/lib/libarchive.19.dylib' (no such file), '/usr/lib/libarchive.19.dylib' (no such file, not in dyld cache))
Wentzell commented 10 months ago

Dear @Crampon16

Thank you for pointing out this issue.

Do you get the same Problem if you do not install TRIQS at all?

Wentzell commented 10 months ago

I personally can't reproduce the issues on my M1 MacBook Pro.

We are investigating your problem.

Thoemi09 commented 10 months ago

Dear @Crampon16,

I assume you installed everything into the conda base environment? Can you try installing triqs and jupyter into a new environment? So after installing miniconda, you could do something like

conda create -n triqs
conda activate triqs
conda install jupyter
conda install -c conda-forge triqs

Note, if you install triqs before jupyter, you need to install jupyter from conda-forge, i.e. conda install -c conda-forge jupyter

Crampon16 commented 10 months ago

@Wentzell Installing Jupyter first (in the base environment) does not seem to break things, and notebooks look usable.

@Thoemi09 Using your commands and creating triqs in a separate environment removes completely the conda error message about libmamba and dynamic libraries, and the installation works. Installing jupyter from conda-forge makes it possible to complete the installation, but the error message stays.

I also just checked and the error message also appears if I install mamba using conda install -c conda-forge mamba in the base environment. Maybe this is actually not a triqs problem ?

Thoemi09 commented 10 months ago

Installing jupyter from conda-forge makes it possible to complete the installation, but the error message stays.

Do you still get the error message in a separate environment? Or just in the base?

I also just checked and the error message also appears if I install mamba using conda install -c conda-forge mamba in the base environment. Maybe this is actually not a triqs problem ?

Yes, I think so too. I can reproduce similar errors when installing other packages in the base env. I don't think it is written somewhere explicitly, but it is probably best to always create separate environments when possible.

Crampon16 commented 10 months ago

I just checked, installing triqs then jupyter, both through conda-forge, in a separate environment yields no error message.

Except if you have further tests to propose, I think we can close this. Thanks for your help !

Thoemi09 commented 10 months ago

No problem!

Just to wrap things up: The error seems to be related to: https://github.com/conda-forge/libarchive-feedstock/issues/69, which comes from a general compatibility issue between conda-forge and the defaults channel as described in https://conda-forge.org/docs/user/tipsandtricks.html.

In fact, adding conda-forge as a channel and setting the channel priority to strict before installing triqs and jupyter gets rid of the error message, even in the base env:

conda config --add channels conda-forge
conda config --set channel_priority strict
conda install triqs
conda install jupyter

However, it is recommended to use new environments anyway (see https://conda-forge.org/docs/user/introduction.html).

Wentzell commented 10 months ago

Thank you @Thoemi09 for the clarifications, and for providing instructions for a workaround!

This looks to be more of an anaconda issue than a triqs issue, so we are closing this.

Wentzell commented 10 months ago

We updated the documentation accordingly https://github.com/TRIQS/triqs/commit/39e05060a31fa0f5a8a9f2834cf1adf5c9fc8ae0