Can't run catkin_make, can't resolve UnicodeDecodeError - ros

this is driving me crazy, I already tried a lot of things,e.g. changing locale, but still getting this after workspace init and then doing catkin_make on subdir.
Running on a recent arch dist, ros-indigo, python2.7 and python 3.5 installed
johnny#localhost:~/ros$ catkin_make
Base path: /home/johnny/ros
Source space: /home/johnny/ros/src
Build space: /home/johnny/ros/build
Devel space: /home/johnny/ros/devel
Install space: /home/johnny/ros/install
####
#### Running command: "cmake /home/johnny/ros/src -DCATKIN_DEVEL_PREFIX=/home/johnny/ros/devel -DCMAKE_INSTALL_PREFIX=/home/johnny/ros/install -G Unix Makefiles" in "/home/johnny/ros/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/johnny/ros/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/indigo
-- This workspace overlays: /opt/ros/indigo
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using default Python package layout
-- Using empy: /usr/lib/python2.7/site-packages/em.py
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/johnny/ros/build/test_results
-- Found gtest: gtests will be built
CMake Warning at /opt/ros/indigo/share/catkin/cmake/test/nosetests.cmake:96 (message):
nosetests not found, Python tests can not be run (try installing package
'python3-nose')
Call Stack (most recent call first):
/opt/ros/indigo/share/catkin/cmake/all.cmake:147 (include)
/opt/ros/indigo/share/catkin/cmake/catkinConfig.cmake:20 (include)
CMakeLists.txt:52 (find_package)
-- catkin 0.6.18
-- BUILD_SHARED_LIBS is on
/opt/ros/indigo/share/catkin/cmake/em/order_packages.cmake.em:23: error: <class 'UnicodeDecodeError'>: 'ascii' codec can't decode byte 0xc3 in position 205: ordinal not in range(128)
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/em.py", line 3302, in <module>
if __name__ == '__main__': main()
File "/usr/lib/python2.7/site-packages/em.py", line 3300, in main
invoke(sys.argv[1:])
File "/usr/lib/python2.7/site-packages/em.py", line 3283, in invoke
interpreter.wrap(interpreter.file, (file, name))
File "/usr/lib/python2.7/site-packages/em.py", line 2295, in wrap
self.fail(e)
File "/usr/lib/python2.7/site-packages/em.py", line 2284, in wrap
callable(*args)
File "/usr/lib/python2.7/site-packages/em.py", line 2359, in file
self.safe(scanner, done, locals)
File "/usr/lib/python2.7/site-packages/em.py", line 2401, in safe
self.parse(scanner, locals)
File "/usr/lib/python2.7/site-packages/em.py", line 2421, in parse
token.run(self, locals)
File "/usr/lib/python2.7/site-packages/em.py", line 1425, in run
interpreter.execute(self.code, locals)
File "/usr/lib/python2.7/site-packages/em.py", line 2595, in execute
_exec(statements, self.globals, locals)
File "<string>", line 17, in <module>
File "/usr/lib/python2.7/site-packages/catkin_pkg/topological_order.py", line 111, in topological_order
for path, package in find_packages(space).items():
File "/usr/lib/python2.7/site-packages/catkin_pkg/packages.py", line 83, in find_packages
packages = find_packages_allowing_duplicates(basepath, exclude_paths=exclude_paths, exclude_subspaces=exclude_subspaces, warnings=warnings)
File "/usr/lib/python2.7/site-packages/catkin_pkg/packages.py", line 110, in find_packages_allowing_duplicates
packages[path] = parse_package(os.path.join(basepath, path), warnings=warnings)
File "/usr/lib/python2.7/site-packages/catkin_pkg/package.py", line 370, in parse_package
return parse_package_string(f.read(), filename, warnings=warnings)
File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 205: ordinal not in range(128)
CMake Error at /opt/ros/indigo/share/catkin/cmake/safe_execute_process.cmake:11 (message):
execute_process(/home/johnny/ros/build/catkin_generated/env_cached.sh
"/usr/bin/python" "/usr/lib/python2.7/site-packages/em.py" "--raw-errors"
"-F" "/home/johnny/ros/build/catkin_generated/order_packages.py" "-o"
"/home/johnny/ros/build/catkin_generated/order_packages.cmake"
"/opt/ros/indigo/share/catkin/cmake/em/order_packages.cmake.em") returned
error code 1
Call Stack (most recent call first):
/opt/ros/indigo/share/catkin/cmake/em_expand.cmake:25 (safe_execute_process)
/opt/ros/indigo/share/catkin/cmake/catkin_workspace.cmake:35 (em_expand)
CMakeLists.txt:63 (catkin_workspace)
-- Configuring incomplete, errors occurred!
See also "/home/johnny/ros/build/CMakeFiles/CMakeOutput.log".
See also "/home/johnny/ros/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed'
Thank you very much!

It looks like an unicode problem. In very brief summary, you have passed something that is being interpreted as a string of bytes to something that needs to decode it into Unicode characters, but the default codec (ascii) is failing.
More on this here.
there's a lot of solutions to this one. the one I suggest is doing this :
yassin#pc:/usr/local/lib/python2.7/site-packages# cat sitecustomize.py
# encoding=utf8
import sys
reload(sys)
sys.setdefaultencoding('utf8')
and to check if that works, you need to do the following :
yassin#pc:~/home# python
Python 2.7.6 (default, Dec 6 2013, 14:49:02)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> reload(sys)
<module 'sys' (built-in)>
>>> sys.getdefaultencoding()
'utf8'
>>>
Hope it helps ! Cheers.

Set the system default locale to en_IN.utf8 should solve the problem.
For example, if you use bash, you can add below lines into your ~/.bashrc:
LANG=en_IN.utf8
export LANG
The catkin toolkit use system default locale to load message or service files.

Related

Xonsh error while importing module PyPDF2

I am having trouble importing modules from within xonsh script that are installed in to the virtual environment.
I installed the virtual environment using vox
xontrib load vox
vox activate venv
pip install PyPDF2
Here is my minimal example
#!/usr/bin/env xonsh
import PyPDF2
If I run this from within the Python interpreter it works:
$ python
Python 3.8.10 (default, Nov 26 2021, 20:14:08)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyPDF2
>>>
If I try to run the xonsh script as a script I get the following:
$ ./minimaltest.x
sh
/usr/lib/python3/dist-packages/apport/report.py:13: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import fnmatch, glob, traceback, errno, sys, atexit, locale, imp, stat
Traceback (most recent call last):
File "/usr/bin/xonsh", line 4, in <module>
main()
File "/usr/lib/python3/dist-packages/xonsh/__amalgam__.py", line 24019, in main
_failback_to_other_shells(args, err)
File "/usr/lib/python3/dist-packages/xonsh/__amalgam__.py", line 23983, in _failback_to_other_shells
raise err
File "/usr/lib/python3/dist-packages/xonsh/__amalgam__.py", line 24017, in main
return main_xonsh(args)
File "/usr/lib/python3/dist-packages/xonsh/__amalgam__.py", line 24060, in main_xonsh
run_script_with_cache(
File "/usr/lib/python3/dist-packages/xonsh/__amalgam__.py", line 3043, in run_script_with_cache
run_compiled_code(ccode, glb, loc, mode)
File "/usr/lib/python3/dist-packages/xonsh/__amalgam__.py", line 2948, in run_compiled_code
func(code, glb, loc)
File "./minimaltest.xsh", line 2, in <module>
import PyPDF2
ModuleNotFoundError: No module named 'PyPDF2'
Any thoughts about what might be wrong?
xonsh can only import modules that exist in the same venv that it is installed in. If you install xonsh into the same venv as PyPDF2 it should work.

How to fix numpy fail with missing libcblas.so.3 on alpine docker

I had installed numpy on alpine docker and everything looked good before running numpy:
Traceback (most recent call last):
File "/app/venv/lib/python3.7/site-packages/numpy/core/__init__.py", line 24, in <module>
from . import multiarray
File "/app/venv/lib/python3.7/site-packages/numpy/core/multiarray.py", line 14, in <module>
from . import overrides
File "/app/venv/lib/python3.7/site-packages/numpy/core/overrides.py", line 7, in <module>
from numpy.core._multiarray_umath import (
ImportError: Error loading shared library libcblas.so.3: No such file or directory (needed by /app/venv/lib/python3.7/site-packages/numpy/core/_multiarray_umath.cpython-37m-x86_64-linux-gnu.so)
I found that licblas.so might be in /usr/lib/ as mentioned here: alpine blas
but it wasn't there.
After installing lapack, the missing file libcblas.so.3 appeared in /usr/lib/:
apk add lapack
I had openblas-dev installed from before but that was not sufficient.

How can I fix this error and ingest data from Quandl? Thank you

When I try to run the command in my terminal, it raises an error
I'm using anaconda to install my packages and python 2.7.
$ zipline ingest -b quandl
Traceback (most recent call last):
File "/anaconda3/bin/zipline", line 6, in <module>
from pkg_resources import load_entry_point
File "/anaconda3/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3241, in <module>
#_call_aside
File "/anaconda3/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3225, in _call_aside
f(*args, **kwargs)
File "/anaconda3/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3254, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/anaconda3/lib/python2.7/site-packages/pkg_resources/__init__.py", line 583, in _build_master
ws.require(__requires__)
File "/anaconda3/lib/python2.7/site-packages/pkg_resources/__init__.py", line 900, in require
needed = self.resolve(parse_requirements(requirements))
File "/anaconda3/lib/python2.7/site-packages/pkg_resources/__init__.py", line 786, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'mock>=2.0' distribution was not found and is required by tables
It seems you need to install the mock package:
conda install mock
or, if the previous doesn't work:
conda install -c conda-forge mock

Error in py2app

I am testing py2app on a simple test.py application, doing nothing special.
python == 3.6
py2app == 0.14
It builds fine with no errors when I give this command:
python3.6 setup.py py2app -A
but when I launch it, this is the result:
./dist/test.app/Contents/MacOS/test
Traceback (most recent call last):
File "/Users/fabio/projvenv/dist/test.app/Contents/Resources/__boot__.py", line 132, in <module>
_run()
File "/Users/fabio/projvenv/dist/test.app/Contents/Resources/__boot__.py", line 126, in _run
exec(compile(source, script, 'exec'), globals(), globals())
File "/Users/fabio/projvenv/test.py", line 3, in <module>
import tkinter
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tkinter/__init__.py", line 36, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ValueError: character U+6573552f is not in range [U+0000; U+10ffff]
2017-06-24 11:32:26.266 test[65341:8804502] test Error
downgrading to 0.12 fixed the issue for me. More of a workaround that a fix though but good enough for me at this point

OPEN CV iOS installation

I am installing the opencv in my system followings the command given by open cv http://docs.opencv.org/2.4/doc/tutorials/introduction/ios_install/ios_install.html
I am getting this error Please let me know what I am missing.
anil-Mac-2s-Mac-mini:opencv pws-mac-2$ python platforms/ios/build_framework.py ios
Executing: ['cmake', '-GXcode', '-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_TOOLCHAIN_FILE=/Users/pws-mac-2/Desktop/opencv/platforms/ios/cmake/Toolchains/Toolchain-iPhoneOS_Xcode.cmake', '-DCMAKE_INSTALL_PREFIX=install', '-DENABLE_NEON=ON', '/Users/pws-mac-2/Desktop/opencv', '-DCMAKE_C_FLAGS=-fembed-bitcode', '-DCMAKE_CXX_FLAGS=-fembed-bitcode'] in /Users/pws-mac-2/Desktop/opencv/ios/build/armv7-iPhoneOS
============================================================
ERROR: [Errno 2] No such file or directory
============================================================
Traceback (most recent call last):
File "platforms/ios/build_framework.py", line 183, in <module>
b.build(args.out)
File "platforms/ios/build_framework.py", line 87, in build
self.buildOne(t[0], t[1], mainBD, cmake_flags)
File "platforms/ios/build_framework.py", line 105, in buildOne
execute(cmakecmd, cwd = builddir)
File "platforms/ios/build_framework.py", line 34, in execute
retcode = check_call(cmd, cwd = cwd)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 535, in check_call
retcode = call(*popenargs, **kwargs)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 522, in call
return Popen(*popenargs, **kwargs).wait()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
I am getting this error Please let me know how to resolve . . .
This error happens because cmake is either (a) not installed or (b) not on the user's path.
In this case, the OP had downloaded the cmake gui application from cmake.org, and copied it to /Applications. This app doesn't add the path to the binaries automatically, which is why the script couldn't find cmake.
By adding the path to the cmake binaries (bash syntax):
PATH=$PATH:/Applications/CMake.app/Contents/bin
the OP was able to successfully build opencv.
Most package managers - e.g. homebrew or macports whould have automatically added a path to the user's profile that would have permitted it to run without having to modify the path any more.
You may need to install CMake
My-Mac: opencv$ brew install cmake

Resources