-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Gentoo: ImportError: cannot import name '_gdal_array' from 'osgeo' #8024
Comments
Is this thread relevant? https://lists.osgeo.org/pipermail/gdal-dev/2023-June/057360.html |
I don't know, the error seems to be familiar but there is two main differences.
And other thing that is similar, both are working with numpy 1.25 and we have checked installation orders. |
Other point, I downgrade to 3.6.3 and 3.6.4, in both of them there is the error:
While if I run parsing
But...! this on the 3.7.0 still sends the same error. |
The installation of (You gave no exact details on how you downgraded from 3.7.0 to 3.6.4, so sorry if you have already tried this.) |
@latot Regarding,
can you provide a step-by-step way of how you installed GDAL ? I'm a Ubuntu user and have zero knowledge of gentoo specificites. I got the "gentoo/stage3" Docker image and when logged into it tried "emerge-webrsync" and then "emerge gdal", but I get the following messages:
It also seems there's only GDAL 3.6.4, not 3.7.0 |
a venv is for the Python bindings, not the core library. First we'd need to know how libgdal 3.7.0 was installed, before going to the Python bindings themselves |
Hi! GDAL is installed in the system, while the python module is on a pyenv. :O testing gentoo, is a great distro to test things :3 As a basic of Gentoo, there you can choose the version of the libs that you want, and enable different compilation options. Due to what I wrote above, there is a more complex depednency tree, for example, as you post, if you want to install GDAL, you need the zlib dep, but not only that, zlib must be compiled with the minizip compilation option. Check this line:
All the "-" options means they are not used in compilation, while the ones that does not have it means will be used in the compilation. the CPU optimization will be excluded now. How can I unable an compilation option? usualled USE flags:
How can I choose a different version of a package? (upgrade not downgrade, I'll skip downgrade now)
As you notice, you need to says the arch, so lets get a little more info to use both. First install gentoolkit, it has the tools to check it: If requests an USE or package, do the same what I did above. then you have this options:
While more options you choose usually more deps will be installed. Be careful, Gentoo compiles from 0, in my case I choose to use almost all the GDAL options, so it takes a while to install. Usually have a full gentoo env uses a lot of time, has its super benefits but is not something that all ppl would need, you can even install you package from github and what you want without break the system. In my case I'm testing apps a lot of the time, in ubuntu you can easily break the system, here is more flexible. When you choose the GDAL options you want, add them to the system, then you can emerge it. In order to avoid conflicts, check the actual python version, GDAL has bindings for 3.10 and 3.11, you need to choose one, choose the system one. I recommend for now
I have enabled almost all of GDAL, I don't use java so is disabled, HDF5 compilation is a little buggy now, so is disabled too, I also excluded the test use, I don't run them.
If you have enough cores, you can compile in parallel, for now lets just put parallel on the compilation, can also be packages installed in parallel, you only need to add the usual -j and -l options of make on a variable like this:
Hope I was able to explain enough to compile GDAL, there is a lot of excluded things, compiler optimizations, system profiles (for what you will use the system), kernel options, user config, etc, etc. But lets keep it minimal. Thx! |
@latot I'm afraid I have to give up regarding trying on Gentoo despite your explanations. Much above my head! I can't afford spending hours/days learning Gentoo. All I can say is that things work fine on Ubuntu 20.04 with a custom Python 3.10 build:
|
mmm, we have a few options. First, I can instead the explanations of gentoo, just step by step, in a blind way, then if there is any issues in the install you tell me. Other one, can you test with wheel installed? you will need to uninstall numpy and gdal, then install first wheel and then all the others. Last one, how can I check something of this on my env? what would be useful to know? |
provide the detail log in verbose mode of the pip install |
Logs!:
I was checking.... where is Thx! |
isn't there a way to get the actual build logs ? Maybe you need to clean /home/pipe/.cache/pip/wheels/ first |
Oks, now worked the logs:
thx! |
"WARNING: numpy not available! Array support will not be enabled" is definitely an issue. |
weird.... I executed all again, with Then checking the installed packages:
....., seems GDAL is not detecting numpy for some reason. |
@rouault I was able to found where the problem can be, I create a simple code that helps to test it, but is not a GDAL problem. For some reasons, some times we are unable to import modules from There seems to be a similar issue, no idea if there is a workaround for GDAL here. And thx helping so much! |
@rouault there seems to be a problem in the order in setup.py pypa/pip#12130 (comment) |
@latot Experimenting a bit, I can reproduce your issue in a venv that does NOT have numpy installed before doing "pip install gdal[numpy]" and DOES have So basically it seems you have no other choice in doing in 2 steps:
|
actually, that fails too, I was able to find the problem, is related to setuptools. But I'll open a new issue with that, I'll explain it. |
closing that ticket, due to #8069 being more explicit |
At least this suggested solution solved my problem. But this can´t be the solution of this issue. |
I dont want to open this feature but going back to gdal 3.6.2 with python3.11 and this answer solved the issue for me. I tried every suggestion here and also everthing i could find on the internet. So maybe this will help someone in the future. https://gis.stackexchange.com/a/465888 My adapation for my Dockerfile
|
Hi all, before ppl says "check related issue" here it is: #5844
Oks, first I was playing with gdal and rio, when I tried to write a raster band and I got that error, here a sample code:
A lot of the code comes from rio/numpy guides.
Here the output:
Some info about my system.
Linux 64 Gentoo
Python with GDAL 3.7.0 and numpy 1.25.0
Installed with wheel and following the method of the issue posted above.
GDAL 3.7.0 on system.
Thx!
The text was updated successfully, but these errors were encountered: