I am trying to install in mac machine Torch7. When I am trying to install torch using this tutorial https://github.com/torch/torch7/wiki/Cheatsheet#installing-and-running-torch on the second line(curl -sk https://raw.githubusercontent.com/torch/ezinstall/master/install-luajit+torch | bash) I am facing the following error:
-- Looking for QT_MAC_USE_COCOA - found
CMake Error at /usr/local/Cellar/cmake/2.8.12.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
Could NOT find Qt4 (missing: QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE
QT_UIC_EXECUTABLE) (found suitable version "4.7.4", minimum required is
"4.3.0")
Call Stack (most recent call first):
/usr/local/Cellar/cmake/2.8.12.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE)
/usr/local/Cellar/cmake/2.8.12.2/share/cmake/Modules/FindQt4.cmake:1393 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:27 (FIND_PACKAGE)
Have you experienced this problem before?
Thanks
After running curl -s https://raw.githubusercontent.com/torch/ezinstall/master/install-all | bash as advised at https://github.com/torch/ezinstall I got the same error, i.e.
Could NOT find Qt4 (missing:
QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE
QT_UIC_EXECUTABLE) (found suitable version "4.8.6", minimum required is
"4.3.0")
When I ran which qmake I found that qmake was located in ~/anaconda/bin/qmake. I tried a bunch of different things to set the QT_MOC_EXECUTABLE, QT_RCC_EXECUTABLE, and QT_UIC_EXECUTABLE paths correctly e.g.
qmake -set "QT_MOC_EXECUTABLE" /usr/local/Cellar/qt/4.8.6/bin/moc
qmake -set "QT_RCC_EXECUTABLE" /usr/local/Cellar/qt/4.8.6/bin/rcc
qmake -set "QT_UIC_EXECUTABLE" /usr/local/Cellar/qt/4.8.6/bin/uic
But nothing worked.
So what I did was remove the anaconda installation via rm -rf ~/anaconda
I ran curl -s https://raw.githubusercontent.com/torch/ezinstall/master/install-all | bash again, and everything install correctly. Then I just reinstalled anaconda.
That was a relief. It's probably not the best solution, but I hope this can also work for you.
Related
I am trying to upgrade QGIS from 3.10 to 3.20 and this requires upgrading CMake to >=3.15 and Python >= 3.7. I am using an EOL Linux distribution (Fedora 28, upgrading the OS is the obvious easy fix but this has to be done on 28, no questions asked). I've installed both CMake (3.19.4) and Python (3.7.9) to my local directories, set them to path, and have added the following CMake options:
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/usr/local -DWITH_SERVER=ON \
-DPYTHON_EXECUTABLE=/usr/local/bin/python3.7 -D......
yet I receive the following error:
CMake Error at /usr/local/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:218 (message):
Could NOT find Python (missing: Python_EXECUTABLE Interpreter) (found
suitable version "3.7.9", minimum required is "3.7")
Reason given by package:
Interpreter: Cannot use the interpreter "/usr/local/bin/python3.7"
Call Stack (most recent call first):
/usr/local/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:582 (_FPHSA_FAILURE_MESSAGE)
/usr/local/share/cmake-3.19/Modules/FindPython/Support.cmake:3148 (find_package_handle_standard_args)
/usr/local/share/cmake-3.19/Modules/FindPython.cmake:428 (include)
CMakeLists.txt:946 (find_package)
Any suggestions on how to proceed? I've added the flags "-DCMAKE_PYTHON_INCLUDE_DIR" and "-DCMAKE_PYTHON_LIBRARY", made sure I configured the local Python to have shared libraries enabled and this either changes nothing or reverts to finding the older Python on my path (3.6.8).
I have only recently started to learn programming with python. Currently I am trying to install pygame but I am constantly gettting the same error:
C:\WINDOWS\system32>python -m pip install pygame
Collecting pygame
Using cached pygame-1.9.2.tar.gz
Complete output from command python setup.py egg_info:
WARNING, No "Setup" File Exists, Running "config.py"
Using WINDOWS configuration...
Path for SDL not found.
Too bad that is a requirement! Hand-fix the "Setup"
Path for FONT not found.
Path for IMAGE not found.
Path for MIXER not found.
Path for PNG not found.
Path for JPEG not found.
Path for PORTMIDI not found.
Path for COPYLIB_tiff not found.
Path for COPYLIB_z not found.
Path for COPYLIB_vorbis not found.
Path for COPYLIB_ogg not found.
If you get compiler errors during install, doublecheck
the compiler flags in the "Setup" file.
Continuing With "setup.py"
Error with the "Setup" file,
perhaps make a clean copy from "Setup.in".
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\filip\appdata\local\temp\pip-build-0xsf1b\pygame\setup.py", line 165, in <module>
extensions = read_setup_file('Setup')
File "C:\Python33\lib\distutils\extension.py", line 164, in read_setup_file
line = expand_makefile_vars(line, vars)
File "C:\Python33\lib\distutils\sysconfig.py", line 430, in expand_makefile_vars
s = s[0:beg] + vars.get(m.group(1)) + s[end:]
TypeError: Can't convert 'NoneType' object to str implicitly
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\filip\appdata\local\temp\pip-build-0xsf1b\pygame\
I already went through a number of posts with similar problems but none of them had the exactly same issue, and/or they were concerned with different packages and operating systems. Moreover, I tried a couple of solutions to those problems but nothing worked for me (i tried upgrading pip, installing with easy_install and some other options I, unfortunately, cannot even recall at this point...).
I would be sincerely grateful if someone can help me with this problem. I am aware that it is possibly an irrelevant or "newbie" question, but I honestly tried finding a solution on my own and really have no more clue what to do. I have also never been really educated in computer science, so all of these things frustrate and confuse the hell out of me and constantly get in the way of the learning process (which is hard enough).
I am using Windows 10, python 3.3 64-bit.
Thank you!
Another way to install pygame, which worked for me (W10 64bit, Python 3.4.5).
Head here and download the correct pygame wheel file for your version. Then, from cmd, go to the directory the file is in, and type pip install [COMPLETE EXACT FILENAME].
Good luck!
I had the same problem but i solved it by updating pip
Try install pygame from this repository: http://www.lfd.uci.edu/~gohlke/pythonlibs/
It is not a official place, but it is trusted. I was having this same problem, and I resolved it installing the package (pygame) from this website. You just have to download the intended".whl" file and install with "pip" from the place where your download is placed.
Don't forget uninstall the previous Pygame installed. =)
Try upgrading pip. Simply open your command line (search cmd in your task bar search box) and enter the command below:
pip install --upgrade pip
Just downgrade your Python version. Uninstall your current Python and delete uninstalled python folder, then install python3.5.
Last, you can use the command line:
pip3 install pygame
It worked for me.
Check your mysql configuration file using this:
mysql_config
Now you should get an output something like this:
mysql_config
Usage: /usr/bin/mysql_config [OPTIONS]
Compiler: GNU 6.3.0
Options:
--cflags [-I/usr/include/mysql ]
--cxxflags [-I/usr/include/mysql ]
--include [-I/usr/include/mysql]
--libs [-L/usr/lib/x86_64-linux-gnu -lmysqlclient -lpthread -lz -lm -lrt -latomic -ldl]
--libs_r [-L/usr/lib/x86_64-linux-gnu -lmysqlclient -lpthread -lz -lm -lrt -latomic -ldl]
--plugindir [/usr/lib/mysql/plugin]
--socket [/var/run/mysqld/mysqld.sock]
--port [0]
--version [5.7.18]
--libmysqld-libs [-L/usr/lib/x86_64-linux-gnu -lmysqld -lpthread -lz -lm -lrt -latomic -lcrypt -ldl -laio -llz4 -lnuma]
--variable=VAR VAR is one of:
pkgincludedir [/usr/include/mysql]
pkglibdir [/usr/lib/x86_64-linux-gnu]
plugindir [/usr/lib/mysql/plugin]
Ideally it should contain libmysqld-libs option. If it is not there, as it was not there in my case, you can assume that your mysql is broken.
In this case you can write this configuration to config file directly
Trying to get opencv for python working on Mac OSX - Mavericks but keep getting an image not found for libjpeg.8.dylib when doing import cv from python
(Recently updated from Mountain Lion)
This is what I did:
1.brew tap homebrew/science
2.brew install opencv
3.python
4.import cv
-got the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/Cellar/opencv/2.4.9/lib/python2.7/site-packages/cv.py", line 1, in <module>
from cv2.cv import *
ImportError: dlopen(/usr/local/Cellar/opencv/2.4.9/lib/python2.7/site-packages/cv2.so, 2): Library not loaded: /usr/local/lib/libjpeg.8.dylib
Referenced from: /usr/local/Cellar/opencv/2.4.9/lib/libopencv_highgui.2.4.dylib
Reason: image not found
I looked for libjpeg.8.dylib and found it in /usr/local/Cellar/jpeg/8d/lib/ which, apparently, is not where libopencv_highgui.2.4.dylib is looking.
I'm a bit new to Mac OS and homebrew. Could anyone explain how to resolve this error and get opencv running? I have the python that comes preinstalled with Mac and them python installed by homebrew.
Thank you.
The quick and dirty solution for this is to make a symlink inside of the /usr/local/lib folder pointing to the actual location of libjpeg.8.dylib, like this:
$ sudo ln -s /usr/local/Cellar/jpeg/8d/lib/libjpeg.8.dylib /usr/local/lib/libjpeg.8.dylib
The problem is opencv and python expect libjpeg.8.dylib to be in /usr/local/lib/ but homebrew installs it in /usr/local/Cellar/, hence annoying error.
I used brew a for installing OpenCV on my mac, and ran into this same problem, but it was with an Xcode C++ console application.
However an alternative method to solve the problem is to copy cp the file to the library location.
cp /usr/local/Cellar/jpeg/8d/lib/libjpeg.8.dylib /usr/local/lib/libjpeg.8.dylib
Or the latter, which I don't suggest, just stating another method is to use move mv the entire file location into your /usr/local/lib/ directory.
mv /usr/local/Cellar/jpeg/8d/lib/libjpeg.8.dylib /usr/local/lib/
Just had a similar problem to this (in python import opencv was working for me one day, then the next it threw the same error you are reporting) and this solution just worked for me:
Upgrade your homebrew opencv eg.:
brew upgrade opencv (or in my case brew upgrade opencv3)
Hope this helps
I had a similar problem with the Pillow library on macOS. The solution proposed here to install it from source worked for me. I had to install it to /usr/local/ for Pillow to find it. You'll need command-line tools, which is the purpose of the first line:
xcode-select --install
curl -O -J -L http://www.ijg.org/files/jpegsrc.v8.tar.gz
tar xvfz jpeg*tar.gz # Unzip and untar what you downloaded
cd jpeg-8 # Change directory to wherever it unpacked to
./configure --prefix="/usr/local" # Configure with the necessary prefix
make
sudo make install
Getting this error:
sudo: unable to resolve host coderw#ll
-- Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS)
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108
(message):
Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE)
Call Stack (most recent call first):
/usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:315
(_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-2.8/Modules/FindPythonInterp.cmake:139
(FIND_PACKAGE_HANDLE_STANDARD_ARGS)
Code/cmake/Modules/FindNumPy.cmake:10 (find_package)
CMakeLists.txt:114 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/coderwall/Desktop/rdkit/build/CMakeFiles/CMakeOutput.log".
See also "/home/coderwall/Desktop/rdkit/build/CMakeFiles/CMakeError.log".
I have already installed:
sudo apt-get install python-dev
Environment variable are already set as follow:
PYTHON_INCLUDE_DIRS=/usr/include/python2.7
PYTHON_LIBRARIES=/usr/lib/python2.7/config/libpython2.7.so
Location of python.h : /usr/lib/include/python2.7/python.h
Location of python libs: /usr/lib/python2.7/
How to solve this?
You can fix the errors by appending to the cmake command the -DPYTHON_LIBRARY and -DPYTHON_INCLUDE_DIR flags filled with the respective folders.
Thus, the trick is to fill those parameters with the returned information from the python interpreter, which is the most reliable. This may work independently of your python location/version (also for Anaconda users):
$ cmake .. \
-DPYTHON_INCLUDE_DIR=$(python -c "import sysconfig; print(sysconfig.get_path('include'))") \
-DPYTHON_LIBRARY=$(python -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR'))")
If the version of python that you want to link against cmake is Python3.X and the default python symlink points to Python2.X, python3 -c ... can be used instead of python -c ....
In case that the error persists, you may need to update the cmake to a higher version as stated by #pdpcosta and repeat the process again.
For me this is helpful:
# if using python2
apt-get install python-dev
# if using python3
apt-get install python3-dev
I hit the same issue,and discovered the error message gives misleading variable names. Try setting the following (singular instead of plural):
PYTHON_INCLUDE_DIR=/usr/include/python2.7
PYTHON_LIBRARY=/usr/lib/python2.7/config/libpython2.7.so
The (plural) variables you see error messages about are values that the PythonLibs sets up when it is initialised correctly.
Even after adding -DPYTHON_INCLUDE_DIR and -DPYTHON_LIBRARY as suggested above, I was still facing the error Could NOT find PythonInterp. What solved it was adding -DPYTHON_EXECUTABLE:FILEPATH= to cmake as suggested in https://github.com/pybind/pybind11/issues/99#issuecomment-182071479:
cmake .. \
-DPYTHON_INCLUDE_DIR=$(python -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
-DPYTHON_LIBRARY=$(python -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR'))") \
-DPYTHON_EXECUTABLE:FILEPATH=`which python`
I was facing this problem while trying to compile OpenCV 3 on a Xubuntu 14.04 Thrusty Tahr system.
With all the dev packages of Python installed, the configuration process was always returning the message:
Could NOT found PythonInterp: /usr/bin/python2.7 (found suitable version "2.7.6", minimum required is "2.7")
Could NOT find PythonLibs (missing: PYTHON_INCLUDE_DIRS) (found suitable exact version "2.7.6")
Found PythonInterp: /usr/bin/python3.4 (found suitable version "3.4", minimum required is "3.4")
Could NOT find PythonLibs (missing: PYTHON_LIBRARIES) (Required is exact version "3.4.0")
The CMake version available on Thrusty Tahr repositories is 2.8.
Some posts inspired me to upgrade CMake.
I've added a PPA CMake repository which installs CMake version 3.2.
After the upgrade everything ran smoothly and the compilation was successful.
Some last version of Ubuntu installs Python 3.4 by default and the CMake version from Ubuntu (2.8) only searches up to Python 3.3.
Try to add set(Python_ADDITIONAL_VERSIONS 3.4) before the find_package statement.
Remember to clean CMakeCache.txt too.
This problem can also happen in Windows. Cmake looks into the registry and sometimes python values are not set. For those with similar problem:
http://ericsilva.org/2012/10/11/restoring-your-python-registry-in-windows/
Just create a .reg file to set the necessary keys and edit accordingly to match your setup.
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Python]
[HKEY_CURRENT_USER\Software\Python\Pythoncore]
[HKEY_CURRENT_USER\Software\Python\Pythoncore\2.6]
[HKEY_CURRENT_USER\Software\Python\Pythoncore\2.6\InstallPath]
#="C:\\python26"
[HKEY_CURRENT_USER\Software\Python\Pythoncore\2.6\PythonPath]
#="C:\\python26;C:\\python26\\Lib\\;C:\\python26\\DLLs\\"
[HKEY_CURRENT_USER\Software\Python\Pythoncore\2.7]
[HKEY_CURRENT_USER\Software\Python\Pythoncore\2.7\InstallPath]
#="C:\\python27"
[HKEY_CURRENT_USER\Software\Python\Pythoncore\2.7\PythonPath]
#="C:\\python27;C:\\python27\\Lib\\;C:\\python27\\DLLs\\"
Note that if you are using cMake version 3.12 or later, variable PythonInterp and PythonLibs has been changed into Python.
So we use:
find_package(Python ${PY_VERSION} REQUIRED)
instead of:
find_package(PythonInterp ${PY_VERSION} REQUIRED)
find_package(PythonLibs ${PY_VERSION} REQUIRED)
see https://cmake.org/cmake/help/v3.12/module/FindPython.html for details.
I had upgraded to python3.8 on my system and had an incomplete install. Managed to fix it by installing the rest of the 3.8 packages:
sudo apt-get install python3.8 python3.8-dev python3.8-distutils python3.8-venv
Paste this into your CMakeLists.txt:
# find python
execute_process(COMMAND python-config --prefix OUTPUT_VARIABLE PYTHON_SEARCH_PATH)
string(REGEX REPLACE "\n$" "" PYTHON_SEARCH_PATH "${PYTHON_SEARCH_PATH}")
file(GLOB_RECURSE PYTHON_DY_LIBS ${PYTHON_SEARCH_PATH}/lib/libpython*.dylib ${PYTHON_SEARCH_PATH}/lib/libpython*.so)
if (PYTHON_DY_LIBS)
list(GET PYTHON_DY_LIBS 0 PYTHON_LIBRARY)
message("-- Find shared libpython: ${PYTHON_LIBRARY}")
else()
message(WARNING "Cannot find shared libpython, try find_package")
endif()
find_package(PythonInterp)
find_package(PythonLibs ${PYTHON_VERSION_STRING} EXACT)
In case that might help, I found a workaround for a similar problem, looking at the cmake doc :
https://cmake.org/cmake/help/v3.0/module/FindPythonLibs.html
You must set two env vars for cmake to find coherent versions.
Unfortunately this is not a generic solution...
cmake -DPYTHON_LIBRARY=${HOME}/.pyenv/versions/3.8.0/lib/libpython3.8.a -DPYTHON_INCLUDE_DIR=${HOME}/.pyenv/versions/3.8.0/include/python3.8/ cern_root/
In Python 3.2 and onward distutils.sysconfig is deprecated in favor of sysconfig.
To get all the variable names in data structure and inspect the situation we can use get_paths function
import sysconfig
sysconfig.get_paths()
which will return us a dict with all the relevant variable names as keys, and corresponding paths as values.
When we know the key we can get the value dynamically,
>>> sysconfig.get_path("include")
'C:\\Program Files\\Python310\\Include'
However, the most convenient feature of sysutils for this situation is that it can list all the variables at once from the command-prompt by invoking python -m sysconfig:
$ python -m sysconfig
Platform: "macosx-10.4-i386"
Python version: "3.2"
Current installation scheme: "posix_prefix"
Paths:
data = "/usr/local"
include = "/Users/tarek/Dev/svn.python.org/py3k/Include"
platinclude = "."
platlib = "/usr/local/lib/python3.2/site-packages"
platstdlib = "/usr/local/lib/python3.2"
purelib = "/usr/local/lib/python3.2/site-packages"
scripts = "/usr/local/bin"
stdlib = "/usr/local/lib/python3.2"
Variables:
AC_APPLE_UNIVERSAL_BUILD = "0"
AIX_GENUINE_CPLUSPLUS = "0"
AR = "ar"
ARFLAGS = "rc"
...
Maybe below command line works for you if all of above methods didn't work.
sudo apt-get install cython cython3
On Ubuntu 20 at least, since Python 2.7 is deprecated, you can:
sudo apt install python2.7-dev
And then PYTHON_INCLUDE_DIR can be set to /usr/include/python2.7
The Issue: I am trying to install GTK+ on Ubuntu 12.04, and while it seems to have installed, each time I attempt to run a python program which uses 'import gtk', I get the error:
Traceback (most recent call last):
File "gps_slip_map.py", line 3, in
import gtk
ImportError: No module named gtk
The python code for gps_slip_map.py can be found here
What I've Done So Far: There are a few dependancies that I needed here: osm-gps-map and gtk+.
In order to download osm-gps-map I used the command, from here:
sudo apt-get install libosmgpsmap-dev python-osmgpsmap
In order to download gtk+ I used the command, from here, post #9 by 'p0c4r1':
sudo apt-get install gnome-core-devel build-essential libgtk2.0-dev libgtk2.0-doc devhelp
I have installed both of these and when I attempt to again, I receive confirmation in the form of this message:
Reading package lists... Done
Building dependency tree
Reading state information... Done
libosmgpsmap-dev is already the newest version.
python-osmgpsmap is already the newest version.
gnome-core-devel is already the newest version.
build-essential is already the newest version.
libgtk2.0-dev is already the newest version.
libgtk2.0-doc is already the newest version.
devhelp is already the newest version.
The following packages were automatically installed and are no longer required:
language-pack-zh-hans yaml-cpp language-pack-kde-en libwxgtk2.6-0 language-pack-kde-zh-hans language-pack-kde-en-base libwxbase2.6-0 python-central language-pack-zh-hans-base
language-pack-kde-zh-hans-base
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 165 not upgraded.
A friend who is working with me on this project was able to simply install Ubuntu 12.04 Precise and use the command to install osm-gps-map. This worked for him and the software ran without throwing an ImportError. I did this same thing, and it is not working for me.
Conclusion: Is someone able to help me figure out how to fix this ImportError?
Update 1: It seems as though the PYHTONPATH is correct.... the command 'echo $PYTHONPATH' shows:
PYTHONPATH: /usr/local/lib/python2.7/site-packages/
But, when I use the command 'ls /usr/local/lib/python2.7/site-packages/', it seems as though there is NO GTK listed anywhere.
dateutil ipython-0.14.dev-py2.7.egg-info _mlt.so numpy-1.6.2-py2.7.egg-info pytz wx.pth
freenect-0.0.0-py2.7.egg-info matplotlib mlt_wrap.o pylab.py README wxPython_common-2.8.12.1-py2.7.egg-info
freenect.so matplotlib-1.3.x-py2.7.egg-info mpl_toolkits pylab.pyc serial wxversion.py
IPython mlt.py numpy pyserial-2.6-py2.7.egg-info wx-2.8-gtk2-unicode wxversion.pyc
To me it seems like this is the issue, but I have no idea how to go about manually adding the proper file here so that I can import gtk. Does anyone have any idea how to do this?
Yes - it sounds like you also need the Python binding for GTK+
For example:
apt-get install python-gtk python-glade2
It's also possible that you have a configuration mismatch. Look at the advice in this link:
http://ubuntuforums.org/showthread.php?t=1674508