I am using lazypredict to try to find good algorithms (source: here). The command pip install yields no error, and I have also done the upgrade of the package, yet when I use from lazypredict.Supervised import LazyRegressor (which should work according to the documentation) I end up with the following error:
OSError: dlopen(/Users/gaetanlefloch/opt/anaconda3/lib/python3.9/site-packages/lightgbm/lib_lightgbm.so, 0x0006): Library not loaded: /usr/local/opt/libomp/lib/libomp.dylib
Referenced from: /Users/gaetanlefloch/opt/anaconda3/lib/python3.9/site-packages/lightgbm/lib_lightgbm.so
Reason: tried: '/usr/local/opt/libomp/lib/libomp.dylib' (no such file), '/usr/local/lib/libomp.dylib' (no such file), '/usr/lib/libomp.dylib' (no such file)
Did someone have the same issue (with lazypredict or another package), and how can I overcome it without eventually doing a manual installation ?
Based on the presence of a /Users/... path in the logs you shared, I'm assuming you are on macOS.
LightGBM requires OpenMP by default, and links to it dynamically. That means that it expects to find it installed on your system at runtime.
Use Homebrew (link) to install OpenMP.
brew install libomp
If you are using lightgbm < 4.0 and Homebrew gives you libomp>=15.0, you may need to help Python find that library.
You can do that modifying environment variable LD_LIBRARY_PATH.
export LD_LIBRARY_PATH=/usr/local/opt/libomp/lib:"${LD_LIBRARY_PATH}"
Or by using brew link.
brew link --force libomp
Related
I tried to install antspyx via pip install antspyx.
Why does pip not found my local ITK installation? It is installed in /usr/lib (package insight-toolkit installed via pacman).
Modules/ThirdParty/GDCM/src/gdcm/Source/MediaStorageAndFileFormat/gdcmImageChangePhotometricInterpretation.h:67:64: error: 'numeric_limits' is not a member of 'std'
This is probably related to the version of your compiler. Or maybe ANTs build script has some errors in it. Best place for fowllow-up is ANTs issue tracker.
Ok, I managed the No local ITK installation found message by setting the environment variable ITK_DIR=/usr/lib/cmake/ITK-5.2.
Additionally, I had to set the option -DModule_GenericLabelInterpolator:BOOL=ON in the itk pkgbuild file to avoid further issues.
When I run the Django server, I see this problem !!
OSError: no library called "cairo" was found
no library called "libcairo-2" was found
cannot load library 'libcairo.so': error 0x7e
cannot load library 'libcairo.2.dylib': error 0x
cannot load library 'libcairo-2.dll': error 0x7e
Installing GTK+ didn't work for me.
I solved this problem using UniConverter2.0.
My environments is
Python 3.7
Windows 10 x64
Install uniconvertor-2.0rc4-win64_headless.msi,
Find the "dll" sub-directory under the UniConverter installation path.(In my case, C:\Program Files\UniConvertor-2.0rc4\dlls)
Add this "dll" path to the system path.
Close VSCode and reopen the project.
Try to run the server again.
Enjoy!
WeasyPrint needs the Pango, cairo and GDK-PixBuf libraries. They are part of GTK+ (formerly known as GIMP Toolkit), and must be installed separately.
After installing GTK+ libraries, do :
python -m weasyprint http://weasyprint.org weasyprint.pdf
Starting from Python 3.8, dll's need to be added separately.
Added GTK+, MSYS2, Visual Studio C Compiler and Uniconverter. But, nothing seemed to work.
Finally, got it working after putting the script for calling add_dll_directory.
import os
def set_dll_search_path():
# Python 3.8 no longer searches for DLLs in PATH, so we have to add
# everything in PATH manually. Note that unlike PATH add_dll_directory
# has no defined order, so if there are two cairo DLLs in PATH we
# might get a random one.
if os.name != "nt" or not hasattr(os, "add_dll_directory"):
return
for p in os.environ.get("PATH", "").split(os.pathsep):
try:
os.add_dll_directory(p)
except OSError:
pass
set_dll_search_path()
Source: PyCairo Windows Python3.8 Import Issue
See the solution here:
https://www.programmersought.com/article/47674569357/
You will need to add a path if not added after installations:
C:\Program Files\GTK3-Runtime Win64\bin
I have been solving it many times this way.
If you are using a lightweight Linux Docker Image, it may not include GTK as said above, then, you can include it by adding in your Dockerfile
RUN apt-get update -y
RUN apt-get install python3-cffi python3-brotli libpango-1.0-0 libharfbuzz0b libpangoft2-1.0-0 libgtk-3-dev gcc -y
Where all those packages are recommended to be installed by weasyprint and GCC has the GTK.
Ok I figure this out. you can have a 64 bit version of python that doesn't work. What I have found to work and this could change is the installing the 64 bit version of python from python's website, not from the Microsoft store!
remove any version of python you have installed
download https://www.python.org/ftp/python/3.8.10/python-3.8.10-amd64.exe
install
download and install https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer/releases
exact link is https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer/releases/download/2021-04-29/gtk3-runtime-3.24.29-2021-04-29-ts-win64.exe
note that link is from https://doc.courtbouillon.org/weasyprint/stable/first_steps.html#windows
add bin folder from that (sorry it was somebody else's machine, I use Ubuntu) in your environment path.
run through the first steps on weasyprint and you should be good to go!
Might be a bit late, but I just encoutered the same issue and:
Start here: https://weasyprint.readthedocs.io/en/stable/install.html#windows. Where you will find the links for the GTK Pack that contains the required DLLs.
In my case, I have a 64bit Python, so i use: "Download and run the latest gtk3-runtime-x.x.x-x-x-x-ts-win64.exe"
I did not change the installation directory
Once the installation is completed. I added the path to my variable paths.
I restarted the terminal, made sure I could locate the DLLs with : WHERE libcairo-2.dll. This retured C:\Program Files\GTK3-Runtime Win64\bin\libcairo-2.dll
Then I run python -m weasyprint http://weasyprint.org weasyprint.pdf
and got a few WARNINGs but they are just warnings :)
I have faced same error as well
I haved installed gtk as followed as gtk install in windows
Nothing worked
After that :
python -m pip install pycairo
solved the problem for me
Try this: https://cairocffi.readthedocs.io/en/stable/overview.html#installing-cairo-on-windows
And maybe this will work to: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pycairo
Best option is instal cairocffi trough pipwin
pip install pipwin
pipwin install cairocffi
I want to install METIS for python on windows7.i use:
pip install metis
I got this result:
Requirement already satisfied: metis in
c:\users\mina\appdata\local\programs\python\python36\lib\site-packages
(0.2a4)
and I used the following code:
make config shared=1
I got this result:
make: *** No rule to make target `config'. Stop.
Maybe you can help me.
pip install metis
-or-
easy_install metis
You might need to add "shared=1" to your config options when building Metis from source so it builds a shared library instead of a static one.
Note that the shared library is needed, and isn’t enabled by default by the configuration process. Turn it on by issuing:
make config shared=1
make install
Then, set up your METIS_DLL environment variable:
export METIS_DLL=/usr/local/lib/libmetis.dylib
Source: https://metis.readthedocs.io/en/latest/
The metis-python is just a wrapper, it does not have the core METIS yet, you need to install METIS separately. You can get the source from here:
http://glaros.dtc.umn.edu/gkhome/metis/metis/download
the installation instruction can be found inside the package at Install.txt. Once you download and unpack it, Suraj M's answer above will come in handy.
One more thing to note that when I install python metis on Ubuntu 16.04 machine.
After you make install, you may only get libmetis.so in the /usr/local/lib directory.
Therefore
export METIS_DLL=/usr/local/lib/libmetis.dylib
should be changed to
export METIS_DLL=/usr/local/lib/libmetis.so
I am trying to install cartopy on a Windows machine, and have previously installed QGIS and GEOS through OSGeo4W64. Now, when I try installing cartopy, I get the following error:
fatal error: 'geos_c.h' file not found
As mentioned, GEOS does exist and the file is also to be found within the directory. I the tried giving Pip the absolute path to the library as a global option, as follows:
pip install --global-option="-Lc:\OSGeo4W64\include"
This, unfortunately didn't work because Pip didn't recognise the -L library option:
error: option -L not recognized.
I tried -I, -l, and -i as well, just to see what would happen, but I get the same error every time. I also found examples on how to give paths to global-option and they did use -L and -I without problems. What could I be doing wrong?
Any help would be greatly appreciated.
It depends where you get your GEOS from as to which GEOS header file you should be linking against. If you get it from Christoph Gohlke's excellent binaries, or conda-forge, enthought, or Anaconda, I believe all rename geos_c.h to geos.h. If you get it from other sources, it may be that that renaming doesn't take place.
You can see how conda-forge build cartopy on Windows at https://github.com/conda-forge/cartopy-feedstock/blob/master/recipe/. The two important files:
https://github.com/conda-forge/cartopy-feedstock/blob/master/recipe/bld.bat
https://github.com/conda-forge/cartopy-feedstock/blob/master/recipe/cartopy.win.patch
Notice how that latter patch file renames the header dependency to geos.h, rather than geos_c.h because it is using the GEOS packaged by conda-forge. You may need to do a similar thing in your situation.
A history on this subject can also be found at https://github.com/SciTools/conda-recipes-scitools/issues/29#issuecomment-66497972.
I have tried this to install opencv. The terminal output after installing was:
OpenCV 2.4.13 ready to be used
But when I try to import the module, it says the module doesn't exist.
When I tried:
pkg-config opencv --cflags
to check if opencv was installed, I got:
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
How can I fix this? Is there any other way to install opencv?
Since you are using Python3, You can only choose to build your own cv2.pyd. There is no pre-built version for you to download.
I found another link of installing the Package, which is installing from the source, means that you need to compile the source code.
The general idea is to download the source code you want first. After that, yor will use CMake to build the libraries and the Python wrapper (based on the specific Python version you are using). After build successful, you will then get the cv2.pyd and several OpenCV libraries, you just copy them into your Python site-package. Finally you should be able to import cv2.
I did the same thing in Window for Python3.3, 3.4, and 3.5 by following this tutorial, the general idea is the same but only on different platform. I think it should be helpful as a reference for you.