Found this

https://www.mail-archive.com/gdal-dev@lists.osgeo.org/msg35514.html

So my guess is that is that the shipped OpenJPEG dll is not compatible with the 
gdal.dll, it misses that opj_encoder_set_extra_options() function.


From: gdal-dev <gdal-dev-boun...@lists.osgeo.org> On Behalf Of Even Rouault
Sent: Friday, October 15, 2021 1:38 PM
To: Pedro Venâncio <pedrongvenan...@gmail.com>; gdal-dev@lists.osgeo.org
Subject: Re: [gdal-dev] Running GDAL through Python >= 3.8 on Anaconda - DLL 
load failed



Le 15/10/2021 à 14:05, Pedro Venâncio a écrit :
Hi Even,

I've been trying to tackle this issue and these are my last findings:

https://github.com/conda-forge/gdal-feedstock/issues/541#issuecomment-944228747

Does this make sense to you? Do you remember any change between gdal 3.2.1 and 
3.2.2 that can explain this behaviour?
No, looking at the git diff, nothing significant in the Python bindings has 
changed between 3.2.1 and 3.2.2


Thank you very much!

Pedro

Alexandre Neto <senhor.n...@gmail.com<mailto:senhor.n...@gmail.com>> escreveu 
no dia quinta, 14/10/2021 à(s) 01:26:
Hi pedro,

Are you sure you are not mixing conda channels? Normally, in the same 
environment, you should stick to a single channel to avoid dependency problems.

I also noticed that you are using anaconda. I suggest you use miniconda 
instead. It comes with the bare minimal tools to install and manage the 
packages you explicitly want, instead of installating Gb of packages that 
unless you know them, you will never use.

Alexandre Neto

A quarta, 13/10/2021, 17:16, Pedro Venâncio 
<pedrongvenan...@gmail.com<mailto:pedrongvenan...@gmail.com>> escreveu:
I will ask on GDAL conda-forge, maybe this can be some packaging problem.

Thanks!


Pedro Venâncio <pedrongvenan...@gmail.com<mailto:pedrongvenan...@gmail.com>> 
escreveu no dia quarta, 13/10/2021 à(s) 17:00:
Tried to define several environment variables, but nothing seems to work



Joaquim Manuel Freire Luís <jl...@ualg.pt<mailto:jl...@ualg.pt>> escreveu no 
dia quarta, 13/10/2021 à(s) 16:23:
Não Pedro,

When I look into my own build of the gdall dll I see no dependency on that 
“opj_encoder_set_extra_options” but likely because it’s a different version (I 
build from master).

From my experience on this there is really nothing one can do other than 
rebuild the dll or replace the dependency that is missing the required symbol. 
Nothing we can do from a conda installation.

But ofc my analysis may be all wrong.

Joaquim

From: gdal-dev 
<gdal-dev-boun...@lists.osgeo.org<mailto:gdal-dev-boun...@lists.osgeo.org>> On 
Behalf Of Pedro Venâncio
Sent: Wednesday, October 13, 2021 4:04 PM
To: gdal-dev@lists.osgeo.org<mailto:gdal-dev@lists.osgeo.org>
Subject: Re: [gdal-dev] Running GDAL through Python >= 3.8 on Anaconda - DLL 
load failed

Hi Joaquim,

Thanks for sharing your case. Did you manage to make it work in some way?

I've already uninstalled a test PostgreSQL/PostGIS that I supposed to be the 
source of the conflict, but I keep having the same error.

I also reinstalled conda, but nothing had changed.



Joaquim Manuel Freire Luís <jl...@ualg.pt<mailto:jl...@ualg.pt>> escreveu no 
dia quarta, 13/10/2021 à(s) 15:24:
Hi,

I have a certain horror to python (that I’m trying to fight) a bit of it is 
because I never manage to really use it.

I had and older Miniconda (Mini => 18 GB !!!!) that was so big that I removed 
and installed a new one in which I tried Pedro’s case and got exactly the same 
errors.

I then run a dependency analysis from within the conda shell and found two 
weird things


  1.  The gdal dll depends on a xerces-c_3_2.dll locate at C:\WINDOWS\system32. 
This seems quite dangerous (for dependency sakes) but seems to not cause any 
problem in this case.
  2.  There is a “red mark” on the opj_encoder_set_extra_options symbol and 
this alone can explain the “ImportError: DLL load failed while importing _gdal: 
The specified procedure could not be found.”

Hopefully the screen capture is small enough to get through.

Joaquim

From: gdal-dev 
<gdal-dev-boun...@lists.osgeo.org<mailto:gdal-dev-boun...@lists.osgeo.org>> On 
Behalf Of Even Rouault
Sent: Wednesday, October 13, 2021 2:39 PM
To: Pedro Venâncio <pedrongvenan...@gmail.com<mailto:pedrongvenan...@gmail.com>>
Cc: gdal-dev@lists.osgeo.org<mailto:gdal-dev@lists.osgeo.org>
Subject: Re: [gdal-dev] Running GDAL through Python >= 3.8 on Anaconda - DLL 
load failed


ok, so now you have to inspect the PATH and fix it so that the gdal DLL and its 
dependencies are in it. But all of this sounds like there's something weird in 
your environment. Perhaps a mix of GDAL versions?
Le 13/10/2021 à 15:36, Pedro Venâncio a écrit :

Can you change in __init__.py

                try:
                    os.add_dll_directory(p)
                except FileNotFoundError:
                    continue



to

                try:
                    os.add_dll_directory(p)
                except (FileNotFoundError, OSError):
                    continue

Yes, here is the output:

Traceback (most recent call last):

  File 
"C:\Users\PedroVenancio\anaconda3\envs\arosics\lib\site-packages\osgeo\__init__.py",
 line 21, in swig_import_helper

    return importlib.import_module(mname)

  File 
"C:\Users\PedroVenancio\anaconda3\envs\arosics\lib\importlib\__init__.py", line 
127, in import_module

    return _bootstrap._gcd_import(name[level:], package, level)

  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import

  File "<frozen importlib._bootstrap>", line 991, in _find_and_load

  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked

  File "<frozen importlib._bootstrap>", line 657, in _load_unlocked

  File "<frozen importlib._bootstrap>", line 556, in module_from_spec

  File "<frozen importlib._bootstrap_external>", line 1166, in create_module

  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed

ImportError: DLL load failed while importing _gdal: Impossível localizar o 
procedimento especificado.



During handling of the above exception, another exception occurred:



Traceback (most recent call last):

  File "demo.py", line 1, in <module>

    from osgeo import gdal

  File 
"C:\Users\PedroVenancio\anaconda3\envs\arosics\lib\site-packages\osgeo\__init__.py",
 line 37, in <module>

    _gdal = swig_import_helper()

  File 
"C:\Users\PedroVenancio\anaconda3\envs\arosics\lib\site-packages\osgeo\__init__.py",
 line 34, in swig_import_helper

    return importlib.import_module('_gdal')

  File 
"C:\Users\PedroVenancio\anaconda3\envs\arosics\lib\importlib\__init__.py", line 
127, in import_module

    return _bootstrap._gcd_import(name[level:], package, level)

ModuleNotFoundError: No module named '_gdal'


--

http://www.spatialys.com

My software is free, but my time generally not.
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org<mailto:gdal-dev@lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/gdal-dev

--

http://www.spatialys.com

My software is free, but my time generally not.
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to