I'm trying to install a python program called sonLib, but I'm not able to pass the unittests. I wonder why, because I think I set the PYTHONPATH correctly in my bashrc...
I tried:
1. PYTHONPATH=$PYTHONPATH:$HOME/programs/sonLib
export PYTHONPATH
2. export PYTHONPATH="home/user/programs/sonLib"
Can someone of you show me how to get it to work?
link for sonLib
Installing sonLib.
Place the directory containing sonLib on your python path. i.e.
PYTHONPATH=${PYTHONPATH}:FOO
where FOO/sonLib is the path to the base directory of sonLib.
Compile the C code:
In sonLib type 'make all' then 'make test' to test the installation
Linking the C libraries: all libraries built are placed in 'sonLib/lib'
error message:
cd externalTools && make all
make[1]: Entering directory `/home/user/programs/sonLib/externalTools'
cd cutest && make all
make[2]: Entering directory `/home/user/programs/sonLib/externalTools/cutest'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/user/programs/sonLib/externalTools/cutest'
make[1]: Leaving directory `/home/user/programs/sonLib/externalTools'
cd C && make all
make[1]: Entering directory `/home/user/programs/sonLib/C'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/user/programs/sonLib/C'
PYTHONPATH=.. PATH=../../bin:$PATH python allTests.py --testLength=SHORT --logLevel=CRITICAL
ImportError: No module named site
make: *** [test] Error 1
It says that "Place the directory containing sonLib on your python path. i.e. PYTHONPATH=${PYTHONPATH}:FOO where FOO/sonLib is the path to the base directory of sonLib.".
You declared PYTHONPATH=$PYTHONPATH:$HOME/programs/sonLib. It should be like this: PYTHONPATH=$PYTHONPATH:$HOME/programs.
Maybe you should try to place the sonLib base directory directly in your python path folder. If you have easy_install, the site-package should be the perfect place.
Ok, guys don't know why, but if I unset PYTHONHOME the test pass
Related
I downloaded this library on github and am trying to install with Python using pip install . but the following error message appears:
metaphone_ptbrpy.c (32): fatal error C1083
Cannot open include file: '../source/metaphone_ptbr.h'
No such file or directory
error: command 'C:\\Program Files(x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\ x86_amd64\\
cl.exe' failed with exit status 2
and the file that the error message says does not exist, in fact it does (follow print):
What do I do?
#Edit 1
Print of source folder bellow:
Not sure though Try it with the -e argument. pip install -e youpackage
I got in touch with the library developer, he helped me a lot. I also applied the suggestions that #phd talked about in the question comments. The complete solution:
copy /source folder into the /python folder
edit /python/setup.py
change this:
c_ext = Extension("metaphoneptbr", ["metaphone_ptbrpy.c", join("..", "source", "metaphone_ptbr.c")])
setup(
name='Metaphone-ptbr',
version='1.17',
ext_modules=[c_ext],
include_dirs=[".", join("..", "source")]
)
for this:
c_ext = Extension("metaphoneptbr", ["metaphone_ptbrpy.c", join("source", "metaphone_ptbr.c")])
setup(
name='Metaphone-ptbr',
version='1.17',
ext_modules=[c_ext],
include_dirs=[".", join("source")]
)
edit /python/metaphone_ptbrpy.c:
change this:
#include "../source/metaphone_ptbr.h"
for this:
#include "source/metaphone_ptbr.h"
replace the files /source/metaphone_ptbr.c and /source/metaphone_ptbr.h for this and this
run python setup.py build command in /python folder to build the project and then run pip install . to complete the installation.
to test if everything is okay, just run the command:
from metaphoneptbr import phonetic
print(phonetic('hello'))
PS: if when executing the command above a warning appears, just change the file /python/metaphone_ptbrpy.c for that version
The author said that all these modifications that were necessary to run the Metaphone-ptbr library for Windows 10 will be added to the repository itself, but anyway, I am sharing with you how the solution went step by step.
I'm installing opencv for Python in Ubuntu 18.04 LTS from the official OpenCV release here https://docs.opencv.org/4.1.0/d2/de6/tutorial_py_setup_in_ubuntu.html
after creating the build directory and entering cmake ../ the moment I enter the command to make it's giving me the following error -
Previously I've used OpenCV on Windows. I'm new in Ubuntu. Please help.
In file included from /home/avi/opencv/modules/core/test/test_precomp.hpp:12:0,
from /home/avi/opencv/build/modules/core/opencv_test_core_pch_dephelp.cxx:1:
/home/avi/opencv/modules/core/include/opencv2/core/private.hpp:66:12: fatal error: Eigen/Core: No such file or directory
# include <Eigen/Core>
^~~~~~~~~~~~
compilation terminated.
modules/core/CMakeFiles/opencv_test_core_pch_dephelp.dir/build.make:62: recipe for target 'modules/core/CMakeFiles/opencv_test_core_pch_dephelp.dir/opencv_test_core_pch_dephelp.cxx.o' failed
make[2]: *** [modules/core/CMakeFiles/opencv_test_core_pch_dephelp.dir/opencv_test_core_pch_dephelp.cxx.o] Error 1
CMakeFiles/Makefile2:1287: recipe for target 'modules/core/CMakeFiles/opencv_test_core_pch_dephelp.dir/all' failed
make[1]: *** [modules/core/CMakeFiles/opencv_test_core_pch_dephelp.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2
Go to /home/avi/opencv/modules/core/include/opencv2/core/private.hpp file.
Edit the line: # include <Eigen/Core> to # include <eigen3/Eigen/Core>
Read more about this error from here.
Seems like OpenCV did not find Eigen where it was expecting.
Supposing you installed Eigen:
sudo apt-get install libeigen3-dev
The most correct way would be for you to specify to OpenCV where you installed Eigen by setting the variable EIGEN_INCLUDE_PATH, usually to \usr\include, but check your system.
Another option, instead of editing the OpenCV code, is to create some links between where you installed Eigen, and where OpenCV expects it to be:
cd /usr/include
sudo ln -sf eigen3/Eigen Eigen
sudo ln -sf eigen3/unsupported unsupported
I didn't find the solution for me in this post so I may as well share it if somebody comes by.
Problem : The include was looking for an include called Eigen while I installed Eigen3.
Solution : Create a soft link to create a directory called Eigen that redirect to Eigen3.
sudo ln -s /usr/include/eigen3/Eigen /usr/include/Eigen
https://www.programmersought.com/article/44372970691/
I am installing Swig 3.0.12. This is the first time I have used it. I ran:
make -k check after the installation, and it came back with some boost errors. In the case below they are from the Python check, however the errors for boost have appeared in nearly all of the checks. Are these errors that I should look into correcting and if so, any ideas on how I can go about that?
Errors:
multiple_inheritance_shared_ptr_wrap.cxx:3131:10: fatal error:
'boost/shared_ptr.hpp' file not found
#include <boost/shared_ptr.hpp>
^
1 error generated.
make[2]: *** [python_cpp] Error 1
make[1]: *** [multiple_inheritance_shared_ptr.cpptest] Error 2
.
. (dots indicate the error below occurred later in the check)
.
make[1]: Target `check' not remade because of errors.
make: *** [check-python-test-suite] Error 1
Update: make -k check just completed. The last line of the check returned:
make: Target ``check' not remade because of errors.
I installed homebrew then installed boost. Redid make -k check, and everything passed no problem.
Whenever I try to create a workspace:
~/catkin_ws$ catkin_make
It shows like this:
ImportError: "from catkin_pkg.package import parse_package" failed: No module named 'catkin_pkg'
Make sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH.
CMake Error at /opt/ros/kinetic/share/catkin/cmake/safe_execute_process.cmake:11 (message):
execute_process(/home/usuario/miniconda3/bin/python
"/opt/ros/kinetic/share/catkin/cmake/parse_package_xml.py"
"/opt/ros/kinetic/share/catkin/cmake/../package.xml"
"/home/usuario/catkin_ws/build/catkin/catkin_generated/version/package.cmake")
returned error code 1
Call Stack (most recent call first):
/opt/ros/kinetic/share/catkin/cmake/catkin_package_xml.cmake:63 (safe_execute_process)
/opt/ros/kinetic/share/catkin/cmake/all.cmake:151 (_catkin_package_xml)
/opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:20 (include)
CMakeLists.txt:52 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/usuario/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/usuario/catkin_ws/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed
It seems like there is a problem with catkin_pkg but I dont find the solution
I just installed ROS on Ubuntu 16.04, had the same issue, and fixed it. The location for catkin_pkg is likely not on your PYTHONPATH and needs to be added.
From the error output:
Make sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH.
Try locating catkin_pkg and check your PYTHONPATH. catkin_pkg wasn't on my PYTHONPATH (likely due to other program installs), so I added it and ran catkin_make again, this time successfully.
~/catkin_ws$ locate catkin_pkg
/usr/lib/python2.7/dist-packages/catkin_pkg
~/catkin_ws$ echo $PYTHONPATH
/opt/ros/kinetic/lib/python2.7/dist-packages
To append the catkin_pkg dir to PYTHONPATH (for this session):
~/catkin_ws$ export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.7/dist-packages
For permanency I appended the catkin_pkg dir to PYTHONPATH in my .bashrc (you might want to backup your .bashrc file first, e.g. cp -p ~/.bashrc ~/.bashrc-ros-catkin.bak).
To do this, edit your ~/.bashrc file (you might need to use sudo to edit this file) and add the following two lines to the end of the file:
# manually added for ROS catkin_make workspace setup
export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.7/dist-packages
Save the file and run source to update your session:
~/catkin_ws$ source ~/.bashrc
Check your PYTHONPATH again:
~/catkin_ws$ echo $PYTHONPATH
/opt/ros/kinetic/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages
Obviously the location of your catkin_pkg files might be different to mine, so use that path instead when appending to $PYTHONPATH above.
Now try running catkin_make again. If you get the same error, paste the output of your catkin_pkg location and PYTHONPATH here.
Cheers,
sb
Are you using Anaconda environment?
This issue is quite common with Anaconda's Python installation.
Try: python --version
If you see Anaconda in the output, go to your bashrc file with vi ~/.bashrc and then comment the line where anaconda is added to path.
It would be something like,
export PATH="username/anaconda2/bin:$PATH"
After that source your bashrc with source ~/.bashrc, open a new terminal and navigate to your catkin workspace. Delete the old build folder and try the catkin_make command again.
Should solve your issue.
The Error Output:
ImportError: "from catkin_pkg.package import parse_package" failed: No module named 'catkin_pkg'
Make sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH.
As mentioned above you need have "catkin_pkg" in PYTHONPATH. The easiest way if you ask me is:
$ pip install catkin_pkg
try this : pip install -U rosdep rosinstall_generator wstool rosinstall six vcstools
if pip shows any errror, switch to root and install pip and then try
Actually when you want to use Anaconda and ROS simultaneously then generally this error comes. So firstly go in .bashrc file and comment the path of anaconda.
Export PATH="/home/gaurav/anaconda3/bin:$PATH".
After commenting go in catkin_ws folder and delete the existing folder within the folder and make new src folder.
Then follow three steps:
1 - $ mkdir src
2 - $ catkin_init_workspace src
3 - $ catkin_make
It works for me.
This means you havent sourced ROS into your environment.
Add this line to the last line of your .bashrc file
source /opt/ros/kinetic/setup.bash
Save the .bashrc file, close the current terminal and start your process in a new terminal.
for me, it fixed by
sudo apt-get remove python3-catkin-tools
sudo apt-get install python-catkin-tools
I'm trying to install PyQt5 but I'm getting this error, I read some other posts related to this error but none of them helped.
/home/pathname/Downloads/PyQt-gpl-5.5.1/QtCore/sipQtCoreQJsonValue.cpp:367:30: error: ‘const class QJsonValue’ has no member named ‘toInt’
sipRes = sipCpp->toInt(a0);
^
make[1]: *** [sipQtCoreQJsonValue.o] Error 1
make[1]: Leaving directory `/home/pathname/Downloads/PyQt-gpl-5.5.1/QtCore'
make: *** [sub-QtCore-make_first-ordered] Error 2
I installed Qt5 in my home folder and when I did python configure.py I included qmake to the path of which Qt5 is at and there was no problem with it. But with the make command I'm getting that error.
The version of Qt you have available to the make system must be incompatible with the version of PyQt you are building.