calliope-project / calliope

A multi-scale energy systems modelling framework

Home Page:https://www.callio.pe

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

conda install takes a very long time

maurerle opened this issue · comments

Problem description

Running conda create -c conda-forge -n calliope calliope does not finish somehow.

Running on Debian 12 with conda 23.7.4 with base python 3.10.4

Calliope version

Does not resolve somehow - creating an env and installing with pip works though

Could you try it with mamba? I find it resolves packages a lot more successfully.

Also, you should try and stop the default conda channel from being included. This can slow things down as it has more channels to download and then resolve (a view recommended by mamba devs). Adding -c nodefaults should do the trick.

I already found a workaround by installing from pip:

conda create -n calliope pip
conda activate calliope
pip install calliope

Nodefaults was not faster either (I stopped after 5 minutes):

~ conda create -c conda-forge -c nodefaults -n calliope calliope
Collecting package metadata (current_repodata.json): done
Solving environment: unsuccessful attempt using repodata from current_repodata.json, retrying with next repodata source.
Collecting package metadata (repodata.json): | failed

I just want to state, that the "Quickstart" instructions, weren't so quick at all ;)
which is quite weird as I am creating a new env with only one selected package...

Ok, good to know RE nodefaults. Can you try with mamba? I would highly recommend it as your go-to instead of conda (and we will update our installation instructions accordingly). I also would recommend not mixing conda and pip packages where possible. It might work fine initially but then the environments can become very messy very quickly.

Also, you could try forcing the python version to the highest calliope can be built with: conda create -c conda-forge -c nodefaults -n calliope calliope python=3.9 This should be done by conda by default, but maybe it helps speed things up to pin it explictly.

I heard promising things about mamba, but it is not available as a .deb package, and I don't feel like installing it with sudo tee :D
For my needs I more and more find pip sufficient, as it has binary packages (psycopg2-binary, pytorch and so on) as well - reducing the usefulness of conda..?
I am therefore mostly using conda as venv alternative which is globally usable

Setting the python version explicitly did not speed things up for me. How long does this command take on your computer? Maybe this could also be a problem which is only reproducible on Debian12?

EDIT: i could install it after like 10 Minutes - so it has a deterministic end at least :D

It takes less than a minute, but then I have most dependencies cached. It could be a Debian12 thing. I think @sjpfenninger had similar issues on a remote machine recently too, but don't know what distro he was using.

If pip works for you then I would suggest continuing with that as your workaround, but would advise keeping your conda env python version to <=3.9 to ensure you don't accidentally trip up on issues that have led to us choosing this upper limit for now.

Also, you could try forcing the python version to the highest calliope can be built with: conda create -c conda-forge -c nodefaults -n calliope calliope python=3.9 This should be done by conda by default, but maybe it helps speed things up to pin it explictly.

I tried to install Calliope through this procedure, and it worked, as well as it worked through Mamba. Unfortunately, I encountered the same error when launching the Jupyter Notebook.
First, the Jupyter Notebook is not installed, then I installed it in the Calliope environment just created. Then, when launching it, i get the following error, as if smth got lost during the "easy way to install":

Traceback (most recent call last):
  File "C:\Users\Tommaso\anaconda3\envs\calliope\lib\site-packages\notebook\traittypes.py", line 235, in _resolve_classes
    klass = self._resolve_string(klass)
  File "C:\Users\Tommaso\anaconda3\envs\calliope\lib\site-packages\traitlets\traitlets.py", line 2025, in _resolve_string
    return import_item(string)
  File "C:\Users\Tommaso\anaconda3\envs\calliope\lib\site-packages\traitlets\utils\importstring.py", line 31, in import_item
    module = __import__(package, fromlist=[obj])
ModuleNotFoundError: No module named 'jupyter_server.contents'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Tommaso\anaconda3\envs\calliope\Scripts\jupyter-notebook-script.py", line 10, in <module>
    sys.exit(main())
  File "C:\Users\Tommaso\anaconda3\envs\calliope\lib\site-packages\jupyter_core\application.py", line 280, in launch_instance
    super().launch_instance(argv=argv, **kwargs)
  File "C:\Users\Tommaso\anaconda3\envs\calliope\lib\site-packages\traitlets\config\application.py", line 1051, in launch_instance
    app = cls.instance(**kwargs)
  File "C:\Users\Tommaso\anaconda3\envs\calliope\lib\site-packages\traitlets\config\configurable.py", line 575, in instance
    inst = cls(*args, **kwargs)
  File "C:\Users\Tommaso\anaconda3\envs\calliope\lib\site-packages\traitlets\traitlets.py", line 1311, in __new__
    inst.setup_instance(*args, **kwargs)
  File "C:\Users\Tommaso\anaconda3\envs\calliope\lib\site-packages\traitlets\traitlets.py", line 1354, in setup_instance
    super(HasTraits, self).setup_instance(*args, **kwargs)
  File "C:\Users\Tommaso\anaconda3\envs\calliope\lib\site-packages\traitlets\traitlets.py", line 1330, in setup_instance
    init(self)
  File "C:\Users\Tommaso\anaconda3\envs\calliope\lib\site-packages\notebook\traittypes.py", line 226, in instance_init
    self._resolve_classes()
  File "C:\Users\Tommaso\anaconda3\envs\calliope\lib\site-packages\notebook\traittypes.py", line 238, in _resolve_classes
    warn(f"{klass} is not importable. Is it installed?", ImportWarning)
TypeError: warn() missing 1 required keyword-only argument: 'stacklevel'

We can't diagnose what might be going wrong with Jupyter, but I'd try something like conda create -c conda-forge -c nodefaults -n calliope calliope jupyter notebook python=3.9 - that ought to get you an environment with a working Jupyter installation.

We can't diagnose what might be going wrong with Jupyter, but I'd try something like conda create -c conda-forge -c nodefaults -n calliope calliope jupyter notebook python=3.9 - that ought to get you an environment with a working Jupyter installation.

Magic! It worked, you were very kind. Thanks a lot!