Installation - solving environment: failed

Greetings.

I run Ubuntu 26.04.1 LTS, and I made a fresh environment called “work” with

>conda create -n work python=3.15.2

The system seemed happy and installed a list of things. I activated it with

>conda activate work

and tried to install a basic set of packages (inc. astropy and astroquery) with

>conda install numpy matplotlib astropy astroquery -c conda-forge

and it just couldn’t. It failed to “solve environment.”

I tried to follow the installation instructions at astroquery.readthedocs.io. I tried adding packages one by one. I tried pip, but pip doesn’t seem to know about conda-forge, and can’t find numpy or matplotlib from my source code even after successfully installing. So I made a fresh environment and tried again, but no go. I’m stymied, and my science just came to a screeching halt.

Can anyone help? Thank you.

It is hard to know for sure what the problem is without logs or trace backs but my guess is that at least one of the packages you’re trying to install (including all dependencies) isn’t available yet for Python 3.15
Try downgrading to 3.14 and see if you’re any luckier (you really should be).

Bigger picture: if you want a package manager that resolves conda-forge and PyPI together, pixi is really the only option. Mixing conda install with pip install was always a recipe for disaster. At least now there’s a package manager that does the job sensibly.

Thank you, neutrinoceros!

The installation page mentions the “PyPi” you mentioned, but not as any sort of action item or command that I can use.

Oh, wait, you said “pixi” … I have no information on that. I’m just trying to install astropy and astroquery and pixi is not mentioned in the instructions.

However, I can’t follow those instructions either, because the command

python -m pip install -U --pre astroquery

simply results with the error that python does not have a module called pip.

Is “pip” equivalent to “python -m pip”? No idea. Perhaps you could inform my ignorance on that point.

I did also run into a puzzle where the instructions for miniconda result in me getting conda version 4.9.2 where the latest version is 26.9.4 and I’m pretty sure that’s important.

Anyway, pardon my confusion, but when the installation instructions simply fail, I’m left to stew around with random internet advice.

Best,

Guy

I have an update.

Using only “conda install -c conda-forge XXXX” commands, I can get an environment up and running with numpy, matplotlib, astropy, and astroquery. Yay.

However, when I open a new xterm window and re-enter my conda environment, it’s all gone. Python3 can no longer find matplotlib or astropy or astroquery. So … it lost its environment?

Running “conda info” from inside my latest (called work3) environment yields:

conda info

 active environment : work3
active env location : /home/gworthey/miniconda3/envs/work3
        shell level : 1
   user config file : /home/gworthey/.condarc

populated config files : /home/gworthey/.condarc
conda version : 4.9.2
conda-build version : not installed
python version : 3.8.5.final.0
virtual packages : __glibc=2.43=0
__unix=0=0
__archspec=1=x86_64
base environment : /home/gworthey/miniconda3 (writable)
channel URLs : astroconda/linux-64

package cache : /home/gworthey/miniconda3/pkgs
/home/gworthey/.conda/pkgs
envs directories : /home/gworthey/miniconda3/envs
/home/gworthey/.conda/envs
platform : linux-64
user-agent : conda/4.9.2 requests/2.28.1 CPython/3.8.5 Linux/7.0.0-38-generic ubuntu/26.04.1 glibc/2.43
UID:GID : 1000:1000
netrc file : None
offline mode : False


The paths it mentions for environments and packages do exist.

Yes and no. The difference is that calling pip directly runs whatever pip is on you PATH which may or may not be the one associated with the virtual environment you care about, while `python -m pip` has the benefit that it’ll use the python interpreter and the env you supposedly want.

Our installation instructions are incomplete in the sense that we can’t cover every possible method and tools, so instead we just focus on pip, which is probably still the most commonly available installer and the one most people probably care about, but if you choose to use anything else, like conda, we have to assume you understand how to use it, because again, it is not possible for us to cover every one’s favorite tool.
If you’re using conda to manage your environments, I strongly adivse you don’t use pip in combination with it and instead focus on packages available through conda-forge. If you absolutely need packages from both PyPI and conda-forge, pixi is the only game out there to do this correctly.

My personal tool of choice is uv, as I find it superior to pixi in every aspect I care about. Note that I don’t myself need any package from conda-forge, which uv doesn’t support.

However, when I open a new xterm window and re-enter my conda environment, it’s all gone. Python3 can no longer find matplotlib or astropy or astroquery. So … it lost its environment?

`which python3` should give you a hint. You’re probably not calling into the executable you think you are.
For reference: now you probably see why env management is a topic that cannot be fully covered in any one package’s documentation. It’s an unfortunate situation that’s been around for decades at this point. I recommend learning about your own tools so this kind of problems isn’t so obscure in the future and you can also help others. Trust me, there’ll always be someone who needs it :slight_smile:

Great. If you get all packages you need within the conda channels, that is in fact preferable to bringing pip in, as @neutrinoceros mentioned mixing the two can easily result in inconsistencies.
Sometimes it is hard to avoid, because some specialised packages may not be available from you conda channel, or are not as quickly updated (currently this can be a problem in particular with Python 3.15, as some compiled packages do not yet provide binary packages for this version).
But the env you are showing here is obviously not the one created for python=3.15 as it is not even running 3.9, but some 3.8.5 version! All the major packages you wanted have stopped supporting this Python many versions ago. So you should perhaps try again with 3.15, or if you have problems installing a particular package, with 3.14 for the aforementioned reasons.

As to why your new shell session or xterm does not start in a given environment, for me this is the standard behaviour – with a fresh shell, conda just starts up in the base environment, and then you need to conda activate the env you want to work in. I think there is an auto_activate option in .condarc, but you’d have to check the documentation for that.

HTH