Python Forum
problems with netcdf if I compile Android
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
problems with netcdf if I compile Android
#1
Hi,

I try to compile this repository for Android:
https://github.com/OpenSoaring/OpenSoar

I get this error:
root@Werkstatt:/home/dirk/openvario/android/OpenSoar# make TARGET=ANDROIDFAT
* TARGET = ANDROIDFAT
Features for Android, UNIX, Windows, OpenVario...
PROGRAM_NAME is OpenSoar
PROGRAM_VERSION is 7.43-3.24
GIT_TAG is tags/opensoar-7.43-3.24
fatal: Benötigte einen einzelnen Commit
GIT_COMMIT_ID is 6fa110dd0b
RELEASE_COMMIT_ID is
Git commits: HEAD = 6fa110dd0b vs. RELEASE =
make[1]: Verzeichnis „/home/dirk/openvario/android/OpenSoar“ wird betreten
* TARGET = ANDROID7
* DEBUG = y
* RUN_ARGS = output/ANDROID/armeabi-v7a/dbg/bin/libOpenSoar.so
Features for Android, UNIX, Windows, OpenVario...
PROGRAM_NAME is OpenSoar
PROGRAM_VERSION is 7.43-3.24
GIT_TAG is tags/opensoar-7.43-3.24
fatal: Benötigte einen einzelnen Commit
GIT_COMMIT_ID is 6fa110dd0b
RELEASE_COMMIT_ID is
Git commits: HEAD = 6fa110dd0b vs. RELEASE =
libtiff is using HAVE_GEOTIFF
OpenSoar is using SKYSIGHT_FORECAST
./build/thirdparty.py ./output/ANDROID/armeabi-v7a/lib "armv7a-linux-androideabi" "-mfloat-abi=softfp -mfpu=neon -fpic -funwind-tables -target armv7a-linux-androideabi21" "-I./output/ANDROID/include -DHAVE_POSIX -DHAVE_VASPRINTF -DANDROID -DTWO_LOGO_APP -DHAVE_SKYSIGHT -DSKYSIGHT_LIVE -DSKYSIGHT_FORECAST -DSKYSIGHT_OFFLINE_MODE -DUSE_GEOTIFF -isystem ./output/ANDROID/armeabi-v7a/lib/armv7a-linux-androideabi/include -DEYE_CANDY -DBIONIC -DLIBCPP_NO_IOSTREAM " "-Wl,--no-undefined -Wl,--fix-cortex-a8 -static-libstdc++ -lunwind" "/root/opt/android-ndk-r28/toolchains/llvm/prebuilt/linux-x86_64/bin/clang" "/root/opt/android-ndk-r28/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++" /root/opt/android-ndk-r28/toolchains/llvm/prebuilt/linux-x86_64/bin//llvm-ar "rcs" /root/opt/android-ndk-r28/toolchains/llvm/prebuilt/linux-x86_64/bin//llvm-ranlib /root/opt/android-ndk-r28/toolchains/llvm/prebuilt/linux-x86_64/bin//llvm-strip "/root/opt/android-ndk-r28/toolchains/llvm/prebuilt/linux-x86_64/bin//llvm-windres"
args : 13
: ./build/thirdparty.py
arg LIB_PATH : ./output/ANDROID/armeabi-v7a/lib
arg HOST_TRIPLET : armv7a-linux-androideabi
arg ARCH_CFLAGS : -mfloat-abi=softfp -mfpu=neon -fpic -funwind-tables -target armv7a-linux-androideabi21
arg CPPFLAGS : -I./output/ANDROID/include -DHAVE_POSIX -DHAVE_VASPRINTF -DANDROID -DTWO_LOGO_APP -DHAVE_SKYSIGHT -DSKYSIGHT_LIVE -DSKYSIGHT_FORECAST -DSKYSIGHT_OFFLINE_MODE -DUSE_GEOTIFF -isystem ./output/ANDROID/armeabi-v7a/lib/armv7a-linux-androideabi/include -DEYE_CANDY -DBIONIC -DLIBCPP_NO_IOSTREAM
arg ARCH_LDFLAGS : -Wl,--no-undefined -Wl,--fix-cortex-a8 -static-libstdc++ -lunwind
arg CC : /root/opt/android-ndk-r28/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
arg CXX : /root/opt/android-ndk-r28/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++
arg AR : /root/opt/android-ndk-r28/toolchains/llvm/prebuilt/linux-x86_64/bin//llvm-ar
arg ARFLAGS : rcs
arg RANLIB : /root/opt/android-ndk-r28/toolchains/llvm/prebuilt/linux-x86_64/bin//llvm-ranlib
arg STRIP : /root/opt/android-ndk-r28/toolchains/llvm/prebuilt/linux-x86_64/bin//llvm-strip
arg WINDRES : /root/opt/android-ndk-r28/toolchains/llvm/prebuilt/linux-x86_64/bin//llvm-windres
Traceback (most recent call last):
File "/home/dirk/openvario/android/OpenSoar/./build/thirdparty.py", line 132, in <module>
netcdf,
NameError: name 'netcdf' is not defined
make[1]: *** [build/thirdparty.mk:41: output/ANDROID/armeabi-v7a/lib/stamp] Fehler 1
make[1]: Verzeichnis „/home/dirk/openvario/android/OpenSoar“ wird verlassen
make: *** [build/android.mk:330: output/ANDROID/armeabi-v7a/dbg/bin/libOpenSoar.so] Fehler 2

I need some help to solve the problem, please!
Reply
#2
for anaconda, try: conda install -c conda-forge netCDF4
from command line, and then recompile
Reply
#3
Im working with Ubuntu 22.04 and tried:
apt-get install netCDF4

But dosen't work because netCDF4 dosen't exist. I tried:
apt-get -y install python3-netcdf4

and the packages python3-cftime python3-netcdf4 geting installed, but don't solve the problem
Reply
#4
did you try the command I showed?
It looks like you're working with anaconda, and conda is the anaconda equivalent of pip
Reply
#5
I installed anaconda :
https://accuweb.cloud/resource/articles/...-beginners

Then I tried:
conda install -c conda-forge netCDF4

I get an error:
Downloading and Extracting Packages:

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
Error while loading conda entry point: conda-libmamba-solver (libarchive.so.20: cannot open shared object file: No such file or directory)
Reply
#6
I am not an expert when it comes to Anaconda. I have it installed on one system here, but rarely use it.
So I tried a couple of AI bots.
1st duckduckgo:
duckduckgo Wrote:This error typically occurs when the libarchive library is missing or not properly linked. You can try reinstalling libarchive using your package manager or by running conda install -c conda-forge libarchive to resolve the issue.

Then with Grok (from X) which gives a very detailed answer:
Grok Wrote:The error you're encountering with Anaconda, specifically Error while loading conda entry point: conda-libmamba-solver (libarchive.so.20: cannot open shared object file: No such file or directory), typically arises due to a missing or incompatible libarchive library required by the conda-libmamba-solver. This solver is a faster dependency resolver used by newer versions of Conda, but it can run into issues if the library versions or channels are misaligned. Below, I’ll outline the steps to resolve this issue systematically, focusing on Linux systems (since .so files are associated with Linux), and provide explanations to ensure clarity.
Understanding the Issue

What’s happening? The conda-libmamba-solver plugin is trying to load the libarchive.so.20 shared library but can’t find it in your system’s library paths or Conda environment. This could be due to:
A missing libarchive.so.20 file.
A version mismatch (e.g., you have libarchive.so.13 or another version).
Incompatible package channels (e.g., mixing conda-forge and defaults channels).
A corrupted or misconfigured Conda installation.
Why does it matter? This error can prevent Conda commands from working properly, especially those relying on the libmamba solver, which is the default in newer Conda versions (23.10 and later).

Solution Steps
Follow these steps in order to resolve the issue. Each step builds on the previous one, and I’ve included checks to avoid unnecessary actions.
1. Check for libarchive in Your Conda Environment

Why? You need to confirm whether libarchive is installed and which version is present.
How? Run the following command to list installed packages:
bash

conda list | grep libarchive

What to look for?
If libarchive is listed, note its version and channel (e.g., conda-forge or defaults).
If it’s missing, you’ll need to install it.
Next steps:
If libarchive is present but the version doesn’t match (e.g., you have libarchive.so.13 instead of libarchive.so.20), proceed to Step 2.
If libarchive is not installed, try installing it (see Step 3).

2. Locate the libarchive.so Files

Why? The error indicates libarchive.so.20 is missing, but you may have a different version (e.g., libarchive.so.13) that could be used as a workaround.
How? Check the Conda library directory:
bash

find ~/miniconda3/lib -name "libarchive.so*"
# Or, if using Anaconda:
find ~/anaconda3/lib -name "libarchive.so*"

Replace ~/miniconda3 or ~/anaconda3 with your Conda installation path if it’s different.
What to look for?
You might see files like libarchive.so.13, libarchive.so.19, or none at all.
Next steps:
If you find a different version (e.g., libarchive.so.13), you can try creating a symbolic link to trick Conda into using it (see Step 4).
If no libarchive.so files are found, proceed to Step 3.

3. Reinstall libarchive and conda-libmamba-solver from the Same Channel

Why? The error often occurs when libarchive and conda-libmamba-solver are installed from different channels (e.g., conda-forge vs. defaults), causing version mismatches. Reinstalling from the same channel ensures compatibility.
How? Run the following commands to reinstall the necessary packages using the conda-forge channel (recommended for consistency):
bash

conda install --solver=classic conda-forge::conda-libmamba-solver conda-forge::libmamba conda-forge::libmambapy conda-forge::libarchive

The --solver=classic flag avoids using the problematic libmamba solver during this installation.
This command ensures all related packages (conda-libmamba-solver, libmamba, libmambapy, libarchive) are from conda-forge.
Alternative: If you prefer the defaults channel:
bash

conda install -c main libarchive -n base --force-reinstall --solver=classic

What to expect?
This should install or update libarchive to a version that includes libarchive.so.20 or a compatible library.
If the error persists, check the output of conda list | grep libarchive again to confirm the version and channel.
Next steps:
Test Conda with a simple command like conda info or conda env list.
If the error is gone, you’re done! If not, proceed to Step 4.

4. Create a Symbolic Link (Workaround)

Why? If libarchive.so.20 is still missing but you have another version (e.g., libarchive.so.13), you can create a symbolic link to make Conda use the available version. This is a temporary fix and may not always work due to potential ABI incompatibilities.
How? Assuming you found libarchive.so.13 in Step 2:
bash

ln -s ~/miniconda3/lib/libarchive.so.13 ~/miniconda3/lib/libarchive.so.20

Replace ~/miniconda3 with your Conda path and adjust the version numbers as needed.
What to expect?
This creates a link so that when Conda looks for libarchive.so.20, it uses libarchive.so.13.
Run conda info to test if the error is resolved.
Risks:
If the versions are too different, you might encounter new errors or crashes.
If this fails, revert the link:
bash

rm ~/miniconda3/lib/libarchive.so.20

Then proceed to Step 5.
Source: This workaround is mentioned in discussions on Stack Overflow and Conda forums.

5. Reset Conda Configuration

Why? The error might be caused by a misconfigured .condarc file, especially if you’ve manually set the solver to libmamba or mixed channels.
How? Reset the solver to the classic solver and clear channel settings:
bash

conda config --set solver classic
conda config --remove-key channels
conda config --add channels conda-forge

This sets the solver to classic (bypassing libmamba) and prioritizes conda-forge.
What to expect?
The classic solver is slower but more stable and doesn’t rely on libarchive.so.20.
Test with conda info or conda create -n test python=3.9.
Next steps:
If this resolves the issue, you can continue using the classic solver or try reinstalling conda-libmamba-solver later (Step 3).
If the error persists, proceed to Step 6.

6. Update Conda or Reinstall Anaconda/Miniconda

Why? If the above steps fail, your Conda installation might be outdated or corrupted. Updating or reinstalling ensures you have the latest versions and a clean environment.
How to update Conda:
bash

conda update -n base conda

If this fails due to the error, try:
bash

conda update -n base --solver=classic conda

How to reinstall:
Back up your environments (if possible):
bash

conda env export -n base > base_env.yml
conda env export -n your_env > your_env.yml

Uninstall Anaconda/Miniconda:
On Linux:
bash

rm -rf ~/miniconda3
# Or:
rm -rf ~/anaconda3

Remove Conda config files:
bash

rm -rf ~/.condarc ~/.conda

Download and install the latest Miniconda or Anaconda:
Miniconda: https://docs.conda.io/en/latest/miniconda.html
Anaconda: https://www.anaconda.com/products/distribution
Install example (Miniconda):
bash

wget https://repo.anaconda.com/miniconda/Mini...-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh

Restore environments:
bash

conda env create -f base_env.yml
conda env create -f your_env.yml

What to expect?
A fresh installation should include conda-libmamba-solver as the default solver (since Conda 23.10) and resolve library issues.
Test with conda info or conda create -n test python=3.9.
Source: Reinstallation is recommended in Conda documentation and user reports for persistent issues.

7. Verify Library Paths (Advanced)

Why? If libarchive.so.20 exists but Conda can’t find it, the system’s library path (LD_LIBRARY_PATH) might not include the Conda library directory.
How? Check and update the library path:
bash

echo $LD_LIBRARY_PATH

If it doesn’t include your Conda lib directory, add it temporarily:
bash

export LD_LIBRARY_PATH=~/miniconda3/lib:$LD_LIBRARY_PATH

Test Conda:
bash

conda info

To make it permanent, add to your shell configuration (e.g., ~/.bashrc):
bash

echo 'export LD_LIBRARY_PATH=~/miniconda3/lib:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc

What to expect?
This ensures Conda can find libarchive.so.20 if it’s installed but not in the default path.
If this doesn’t work, it’s likely the library is missing or incompatible, so revisit Step 3 or 6.

Additional Notes

Preventing Future Issues:
Always use consistent channels (preferably conda-forge) to avoid version mismatches.
bash

conda config --add channels conda-forge
conda config --set channel_priority strict

Keep Conda updated:
bash

conda update -n base conda

Avoid installing packages in the base environment unless necessary, as it can lead to conflicts.
If You’re on macOS:
The error mentions .so files, suggesting Linux, but if you’re on macOS, you’d see .dylib files (e.g., libarchive.19.dylib). The steps are similar, but replace .so with .dylib in commands (e.g., ln -s ...libarchive.13.dylib ...libarchive.19.dylib).
If the Error Persists:
Share additional details:
Output of conda info.
Output of conda list | grep libarchive.
Your operating system (e.g., Ubuntu 24.04, CentOS 7).
Whether you’re using Miniconda or Anaconda.
Consider reporting the issue on the Conda GitHub: https://github.com/conda/conda-libmamba-solver/issues.

Quick Fix (Try This First)
If you want a fast solution without diving deep:
bash

conda install --solver=classic conda-forge::conda-libmamba-solver conda-forge::libmamba conda-forge::libmambapy conda-forge::libarchive

If that doesn’t work, try:
bash

conda config --set solver classic

Then test with conda info. If it still fails, follow the full steps above.
Sources

Stack Overflow discussions on conda-libmamba-solver errors.
Conda GitHub issues on libarchive incompatibilities.
Reddit threads on Anaconda troubleshooting.
Conda documentation on conda-libmamba-solver.

This should resolve your issue or at least help diagnose it further. Let me know if you need clarification or run into new errors!

Hope there is something here that is useful. The Grok answer is very detailed and looks quite promising.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  combining netcdf data sebastiansieloff 1 2,812 Nov-19-2020, 03:59 PM
Last Post: Larz60+
  Selecting netcdf data files Jodman92 4 3,956 Nov-21-2018, 10:56 PM
Last Post: Larz60+
  Converting units in NetCdf Files in Python fyec 1 5,267 Jun-18-2018, 12:53 PM
Last Post: gontajones
  Storing Python data output as a Netcdf file Lightning1800 1 3,262 May-16-2018, 10:14 PM
Last Post: micseydel
  netCDF issue with filling a variable HeavyLoads 1 14,475 Oct-03-2016, 08:34 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020