Dartspacephysiker / e3doubt

Tools for estimating uncertainty of EISCAT_3D experiments
GNU General Public License v3.0
5 stars 2 forks source link

Incompatibility when system python version == python version specified in .yml #2

Open Dartspacephysiker opened 9 months ago

Dartspacephysiker commented 9 months ago

From Ilkka:

I have been running e3doubt with the system python without using anaconda / mamba. Today we tried to install e3doubt in [person]'s computer in a separate conda environment, but I did not manage to do this. I then tried to do the same in my own laptop but that also failed.

I am now testing with my own laptop, and I can confirm that I have R version 4.1.2 and Cmake version 3.22.1.

I also did some googling, and I agree that this seems to be a problem with rpy2 and my R version. I am testing with different versions of rpy2 and r-base in the mamba environment, but so far no success.

If I follow the instructions in github:

git clone https://github.com/Dartspacephysiker/e3doubt
mamba env create -f e3doubt/binder/environment.yml -n e3doubt
mamba activate e3doubt
pip install --editable ./e3doubt

It reports and error in apexpy installation, but creates the environment and installs e3doubt, and I can install apexpy afterwards.

If I then try to run the script you have under the title "First run" in github, I get an error

(e3doubt) ilkkavir@oy2303044:~$ python e3doubtFirstScript.py
Error in .makeMessage(..., domain = domain) :
  3 arguments passed to .Internal(gettext) which requires 2
Error in gettext(fmt, domain = domain, trim = trim) :
  3 arguments passed to .Internal(gettext) which requires 2
Error in Ops.numeric_version(R_version_built_under, "4.0.0") :
  there is no .Internal function 'compareNumericVersion'
Fatal error: unable to initialize the JIT

The same happens if I just try to import the module:

(e3doubt) ilkkavir@oy2303044:~$ python
Python 3.10.13 | packaged by conda-forge | (main, Dec 23 2023,
15:36:39) [GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import e3doubt
Error in .makeMessage(..., domain = domain) :
  3 arguments passed to .Internal(gettext) which requires 2
Error in gettext(fmt, domain = domain, trim = trim) :
  3 arguments passed to .Internal(gettext) which requires 2
Error in Ops.numeric_version(R_version_built_under, "4.0.0") :
  there is no .Internal function 'compareNumericVersion'
Fatal error: unable to initialize the JIT

I also tried a few different ways to create the conda environment, but I just encountered different problems. In the best case I was able to import e3doubt, but it claims that e3doubt.Experiment() does not exist. The installation without anaconda still works well.

Dartspacephysiker commented 9 months ago

Next comment from Ilkka:

I finally managed to run e3doubt in a mamba environment in my own laptop.

The problem is that for some reason ~/.local/lib/python3.10 is in the python search path also in the mamba environment. This seems to mess up both the python module installation and imports in the mamba env. For example, I had different versions of rpy2 in the mamba environment and under ~/.local/lib, and the latter was incorrectly used also in the mamba environment. There were also some version conflicts with apexpy and iri2016 that I had also in ~/.local/lib, and I removed the version requirement from apexpy in e3doubt/binder/environment.yml, because the requested version did not install.

I was able to install with mamba when I temporarily renamed ~/.local/lib/python3.10. I do not want to make this a permanent solution, but we can at least check if we have the same problem in [person]'s computer. We can probably do this tomorrow.

Dartspacephysiker commented 9 months ago

An update:

If I change the python version in e3doubt/binder/environment.yml to 3.11 the mamba installation works like a charm. My "system python" is version 3.10 and using the same version in the mamba env apparently caused problems.

I still do not know if we have the same problem with [person]'s computer, but we will see tomorrow.