pyocd won't load on M1 Mac - python-3.x

I want to use pyocd-gdbserver on my M1 Mac mini, but it won't load.
I'm running Python 3.9 (arm64), and I get this long traceback (below) because some .dylib only has i386 and x86_64 architectures, and what's needed is arm64e (is that different from arm64?).
I don't know what .dylib it is, because pyocd makes an anonymised private copy. I've downloaded the arm64 version of Segger's JLink software, and libusb is also arm64.
I've been running the same board (BBC micro:bit v1.3B) on an Intel Mac, and pyocd worked fine without having installed Segger's JLink firmware on it; but just in case I installed Segger's firmware - no difference.
Here's the log ... (I've folded the lines at the end)
$ pyocd-gdbserver
Traceback (most recent call last):
File "/Users/simon/Library/Python/3.9/bin/pyocd-gdbserver", line 5, in <module>
from pyocd.tools.gdb_server import main
File "/Users/simon/Library/Python/3.9/lib/python/site-packages/pyocd/__init__.py", line 21, in <module>
from . import gdbserver
File "/Users/simon/Library/Python/3.9/lib/python/site-packages/pyocd/gdbserver/__init__.py", line 17, in <module>
from .gdbserver import GDBServer
File "/Users/simon/Library/Python/3.9/lib/python/site-packages/pyocd/gdbserver/gdbserver.py", line 49, in <module>
from ..commands.commander import ToolExitException
File "/Users/simon/Library/Python/3.9/lib/python/site-packages/pyocd/commands/commander.py", line 25, in <module>
from ..core.helpers import ConnectHelper
File "/Users/simon/Library/Python/3.9/lib/python/site-packages/pyocd/core/helpers.py", line 26, in <module>
from ..probe.aggregator import DebugProbeAggregator
File "/Users/simon/Library/Python/3.9/lib/python/site-packages/pyocd/probe/aggregator.py", line 83, in <module>
load_plugin_classes_of_type('pyocd.probe', PROBE_CLASSES, DebugProbe)
File "/Users/simon/Library/Python/3.9/lib/python/site-packages/pyocd/core/plugin.py", line 104, in load_plugin_classes_of_type
if plugin.should_load():
File "/Users/simon/Library/Python/3.9/lib/python/site-packages/pyocd/probe/jlink_probe.py", line 377, in should_load
return JLinkProbe._get_jlink() is not None
File "/Users/simon/Library/Python/3.9/lib/python/site-packages/pyocd/probe/jlink_probe.py", line 50, in _get_jlink
return pylink.JLink(
File "/Users/simon/Library/Python/3.9/lib/python/site-packages/pylink/jlink.py", line 292, in __init__
lib = library.Library()
File "/Users/simon/Library/Python/3.9/lib/python/site-packages/pylink/library.py", line 261, in __init__
self.load_default()
File "/Users/simon/Library/Python/3.9/lib/python/site-packages/pylink/library.py", line 299, in load_default
return self.load(path)
File "/Users/simon/Library/Python/3.9/lib/python/site-packages/pylink/library.py", line 353, in load
self._lib = ctypes.cdll.LoadLibrary(tf.name)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ctypes/__init__.py", line 452, in LoadLibrary
return self._dlltype(name)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ctypes/__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(/var/folders/ch/k_zwspdx3qsfbt1_x21zld6m0000gn/T/tmp5g6hpqrt.dylib, 0x0006): tried:
'/var/folders/ch/k_zwspdx3qsfbt1_x21zld6m0000gn/T/tmp5g6hpqrt.dylib'
(fat file, but missing compatible architecture (have (i386,x86_64), need (arm64e))),
'/private/var/folders/ch/k_zwspdx3qsfbt1_x21zld6m0000gn/T/tmp5g6hpqrt.dylib'
(fat file, but missing compatible architecture (have (i386,x86_64), need (arm64e)))

Related

Python 3.11. Issue

I've installed fresh version of Python 3.11. on Win 10 x64 and figured I should try Jupyter notebook, but after installing it using pip command (without any kind of error and previously adding python to environment variable path) I've received this error:
`
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\Vladimir\AppData\Local\Programs\Python\Python311\Scripts\jupyter-notebook.EXE\__main__.py", line 4, in <module>
File "C:\Users\Vladimir\AppData\Local\Programs\Python\Python311\Lib\site-packages\notebook\notebookapp.py", line 59, in <module>
from tornado import httpserver
File "C:\Users\Vladimir\AppData\Local\Programs\Python\Python311\Lib\site-packages\tornado\httpserver.py", line 32, in <module>
from tornado.http1connection import HTTP1ServerConnection, HTTP1ConnectionParameters
File "C:\Users\Vladimir\AppData\Local\Programs\Python\Python311\Lib\site-packages\tornado\http1connection.py", line 34, in <module>
from tornado import iostream
File "C:\Users\Vladimir\AppData\Local\Programs\Python\Python311\Lib\site-packages\tornado\iostream.py", line 40, in <module>
from tornado.netutil import ssl_wrap_socket, _client_ssl_defaults, _server_ssl_defaults
File "C:\Users\Vladimir\AppData\Local\Programs\Python\Python311\Lib\site-packages\tornado\netutil.py", line 35, in <module>
_client_ssl_defaults = ssl.create_default_context(ssl.Purpose.SERVER_AUTH)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Vladimir\AppData\Local\Programs\Python\Python311\Lib\ssl.py", line 775, in create_default_context
context.load_default_certs(purpose)
File "C:\Users\Vladimir\AppData\Local\Programs\Python\Python311\Lib\ssl.py", line 596, in load_default_certs
self._load_windows_store_certs(storename, purpose)
File "C:\Users\Vladimir\AppData\Local\Programs\Python\Python311\Lib\ssl.py", line 588, in _load_windows_store_certs
self.load_verify_locations(cadata=certs)
ssl.SSLError: [ASN1] nested asn1 error (_ssl.c:4004)
`
searching stack overflow as wheel as gitHub resulted in many dead ends.
I would be very grateful for any kind of assistance.

Problem running Tensorflow (Ubuntu 19.10)

I've recently tried to install and run some python and tensorflow code from this repository.
I followed the manual installation procedure just as mentioned in the README.md present in the repository.
As I've never used tensorflow before, I had to install a lot of packages to get it up and running.
Currently, I've got tensorfow-gpu 1.13, python 3.7, and an Nvidia graphics card (mx250) on my Ubuntu 19.10 laptop, and I wish to get the code running. However, I'm having issues running the demo.sh file present with it.
Here's what I get in the err.txt when I run the command $ bash demo.sh > output.txt 2> err.txt at the cloned directory (after installing all required packages):
*** Aborted at 1575094215 (unix time) try "date -d #1575094215" if you are using GNU date ***
PC: # 0x7f92c7012ae8 ceres::internal::ProgramEvaluator<>::Evaluate()
*** SIGSEGV (#0x0) received by PID 22202 (TID 0x7f92acda5700) from PID 0; stack trace: ***
# 0x7f92c7452641 (unknown)
# 0x7f92c67dd540 (unknown)
# 0x7f92c7012ae8 ceres::internal::ProgramEvaluator<>::Evaluate()
# 0x7f92c709265f ceres::internal::TrustRegionMinimizer::EvaluateGradientAndJacobian()
# 0x7f92c7092f4a ceres::internal::TrustRegionMinimizer::IterationZero()
# 0x7f92c70972d4 ceres::internal::TrustRegionMinimizer::Minimize()
# 0x7f92c7088cbc ceres::Solver::Solve()
# 0x7f92c70899b9 ceres::Solve()
# 0x55bb3bb1a2eb colmap::BundleAdjuster::Solve()
# 0x55bb3bb78037 colmap::IncrementalMapper::AdjustGlobalBundle()
# 0x55bb3bac3f0c (unknown)
# 0x55bb3bac521d colmap::IncrementalMapperController::Reconstruct()
# 0x55bb3bac6a9b colmap::IncrementalMapperController::Run()
# 0x55bb3bbd7dfc colmap::Thread::RunFunc()
# 0x7f92c5ad9f74 (unknown)
# 0x7f92c67d1669 start_thread
# 0x7f92c578f323 clone
Traceback (most recent call last):
File "imgs2poses.py", line 11, in <module>
gen_poses(args.scenedir)
File "/home/abhigyan/Code/CVProject/LLFF/llff/poses/pose_utils.py", line 265, in gen_poses
run_colmap(basedir)
File "/home/abhigyan/Code/CVProject/LLFF/llff/poses/colmap_wrapper.py", line 70, in run_colmap
map_output = ( subprocess.check_output(mapper_args, universal_newlines=True) )
File "/home/abhigyan/anaconda3/lib/python3.7/subprocess.py", line 395, in check_output
**kwargs).stdout
File "/home/abhigyan/anaconda3/lib/python3.7/subprocess.py", line 487, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['colmap', 'mapper', '--database_path', 'data/testscene/database.db', '--image_path', 'data/testscene/images', '--output_path', 'data/testscene/sparse', '--Mapper.num_threads', '16', '--Mapper.init_min_tri_angle', '4', '--Mapper.multiple_models', '0', '--Mapper.extract_colors', '0']' died with <Signals.SIGSEGV: 11>.
Traceback (most recent call last):
File "/home/abhigyan/anaconda3/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/abhigyan/anaconda3/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/abhigyan/anaconda3/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/home/abhigyan/anaconda3/lib/python3.7/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/home/abhigyan/anaconda3/lib/python3.7/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: libcublas.so.10.0: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "imgs2mpis.py", line 10, in <module>
from llff.inference.mpi_utils import run_inference
File "/home/abhigyan/Code/CVProject/LLFF/llff/inference/mpi_utils.py", line 6, in <module>
from llff.inference.mpi_tester import DeepIBR
File "/home/abhigyan/Code/CVProject/LLFF/llff/inference/mpi_tester.py", line 1, in <module>
import tensorflow as tf
File "/home/abhigyan/anaconda3/lib/python3.7/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "/home/abhigyan/anaconda3/lib/python3.7/site-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/home/abhigyan/anaconda3/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/home/abhigyan/anaconda3/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/abhigyan/anaconda3/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/abhigyan/anaconda3/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/home/abhigyan/anaconda3/lib/python3.7/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/home/abhigyan/anaconda3/lib/python3.7/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: libcublas.so.10.0: cannot open shared object file: No such file or directory
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
mkdir: cannot create directory ‘data/testscene/outputs/’: File exists
Traceback (most recent call last):
File "imgs2renderpath.py", line 34, in <module>
poses, bds = load_data(args.scenedir, load_imgs=False)
File "/home/abhigyan/Code/CVProject/LLFF/llff/poses/pose_utils.py", line 195, in load_data
poses_arr = np.load(os.path.join(basedir, 'poses_bounds.npy'))
File "/home/abhigyan/anaconda3/lib/python3.7/site-packages/numpy/lib/npyio.py", line 428, in load
fid = open(os_fspath(file), "rb")
FileNotFoundError: [Errno 2] No such file or directory: 'data/testscene/poses_bounds.npy'
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
demo.sh: line 24: 22221 Aborted (core dumped) cuda_renderer/cuda_renderer data/testscene/mpis_360 data/testscene/outputs/test_path.txt data/testscene/outputs/test_vid.mp4 360 .8 18
When you are going to use Tensorflow in GPU setup, have to carefully install and configure the Tensorflow in your machine. I would like to prefer to use Ubuntu 18.04 LTS version instead of 19.xx.
Follow the installation steps from the blog: https://zhuanlan.zhihu.com/p/49166211

Reducing executable file size with UPX in macOS

I am creating a bundled app with PyInstaller. The app includes numpy so the final size of the bundled app is > 600MB. I want of course to compress the size of the bundled app so I installed upx via brew install upx. However, PyInstaller crashes with the error below.
1- Is there any alternative to UPX or even PyIntaller for macOS?
2- Can I fix this error?
3- Can I run UPX manually after PyInstaller creates the bundled app on selected files? If yes, could you give an example of the command line for UPX?
Error:
Traceback (most recent call last):
File "/Users/Kenny/miniconda3/envs/umsap/bin/pyinstaller", line 11, in <module>
sys.exit(run())
File "/Users/Kenny/miniconda3/envs/umsap/lib/python3.7/site-packages/PyInstaller/__main__.py", line 111, in run
run_build(pyi_config, spec_file, **vars(args))
File "/Users/Kenny/miniconda3/envs/umsap/lib/python3.7/site-packages/PyInstaller/__main__.py", line 63, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "/Users/Kenny/miniconda3/envs/umsap/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 838, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "/Users/Kenny/miniconda3/envs/umsap/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 784, in build
exec(text, spec_namespace)
File "<string>", line 47, in <module>
File "/Users/Kenny/miniconda3/envs/umsap/lib/python3.7/site-packages/PyInstaller/building/osx.py", line 89, in __init__
self.__postinit__()
File "/Users/Kenny/miniconda3/envs/umsap/lib/python3.7/site-packages/PyInstaller/building/datastruct.py", line 158, in __postinit__
self.assemble()
File "/Users/Kenny/miniconda3/envs/umsap/lib/python3.7/site-packages/PyInstaller/building/osx.py", line 169, in assemble
fnm = checkCache(fnm, strip=self.strip, upx=self.upx, dist_nm=inm)
File "/Users/Kenny/miniconda3/envs/umsap/lib/python3.7/site-packages/PyInstaller/building/utils.py", line 228, in checkCache
dylib.mac_set_relative_dylib_deps(cachedfile, dist_nm)
File "/Users/Kenny/miniconda3/envs/umsap/lib/python3.7/site-packages/PyInstaller/depend/dylib.py", line 308, in mac_set_relative_dylib_deps
dll = MachO(libname)
File "/Users/Kenny/miniconda3/envs/umsap/lib/python3.7/site-packages/macholib/MachO.py", line 95, in __init__
self.load(fp)
File "/Users/Kenny/miniconda3/envs/umsap/lib/python3.7/site-packages/macholib/MachO.py", line 110, in load
self.load_header(fh, 0, size)
File "/Users/Kenny/miniconda3/envs/umsap/lib/python3.7/site-packages/macholib/MachO.py", line 148, in load_header
hdr = MachOHeader(self, fh, offset, size, magic, hdr, endian)
File "/Users/Kenny/miniconda3/envs/umsap/lib/python3.7/site-packages/macholib/MachO.py", line 188, in __init__
self.load(fh)
File "/Users/Kenny/miniconda3/envs/umsap/lib/python3.7/site-packages/macholib/MachO.py", line 293, in load
read_bytes, header.sizeofcmds))
ValueError: Read 1592 bytes, header reports 1992 bytes

Getting DLL error with 'jupyter lab' command in Anaconda Installation

Getting DLL error with 'jupyter lab' command in Anaconda Installation:
Details for system:
conda 4.5.11
Python 3.7.0
jupyter 4.4.0
Height of weirdness is that I am able to launch jupyter lab from Anaconda Navigator, but 'jupyter lab' is not working and throwing below exception:
Traceback (most recent call last):
File "c:\ml\installed_tools\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\ml\installed_tools\anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\ML\installed_tools\anaconda3\Scripts\jupyter-lab.EXE\__main__.py", line 5, in <module>
File "c:\ml\installed_tools\anaconda3\lib\site-packages\jupyterlab\labapp.py", line 12, in <module>
from jupyterlab_server import slugify, WORKSPACE_EXTENSION
File "c:\ml\installed_tools\anaconda3\lib\site-packages\jupyterlab_server\__init__.py", line 4, in <module>
from .app import LabServerApp
File "c:\ml\installed_tools\anaconda3\lib\site-packages\jupyterlab_server\app.py", line 9, in <module>
from .server import ServerApp
File "c:\ml\installed_tools\anaconda3\lib\site-packages\jupyterlab_server\server.py", line 32, in <module>
from jupyter_server.serverapp import ServerApp, aliases, flags # noqa
File "c:\ml\installed_tools\anaconda3\lib\site-packages\jupyter_server\serverapp.py", line 46, in <module>
from zmq.eventloop import ioloop
File "c:\ml\installed_tools\anaconda3\lib\site-packages\zmq\__init__.py", line 47, in <module>
from zmq import backend
File "c:\ml\installed_tools\anaconda3\lib\site-packages\zmq\backend\__init__.py", line 40, in <module>
reraise(*exc_info)
File "c:\ml\installed_tools\anaconda3\lib\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "c:\ml\installed_tools\anaconda3\lib\site-packages\zmq\backend\__init__.py", line 27, in <module>
_ns = select_backend(first)
File "c:\ml\installed_tools\anaconda3\lib\site-packages\zmq\backend\select.py", line 27, in select_backend
mod = __import__(name, fromlist=public_api)
File "c:\ml\installed_tools\anaconda3\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
from . import (constants, error, message, context,
ImportError: DLL load failed: The specified module could not be found.
Although I have posted this question, but now I also got a solution for the same.
Please add following in the path variable, it will be resolved thereafter (I just checked):
C:\ML\installed_tools\anaconda3 (was already present)
C:\ML\installed_tools\anaconda3\Scripts (was already present)
C:\ML\installed_tools\anaconda3\Library\bin (added now)
C:\ML\installed_tools\anaconda3\Library\mingw-w64\bin (added now)

Cannot load jupyter-notebook from terminal in Ubuntu 14.04

After installing the latest version of Anaconda, and following post-installation steps, I am not able to load jupyter notebook on my system, Ubuntu 14.04.
I get the following error message:
Traceback (most recent call last):
File "./bin/jupyter-notebook", line 6, in <module>
sys.exit(notebook.notebookapp.main())
File "/home/carlos/anaconda3/lib/python3.5/site-packages/jupyter_core /application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/home/carlos/anaconda3/lib/python3.5/site-packages/traitlets/config/application.py", line 588, in launch_instance
app.initialize(argv)
File "<decorator-gen-7>", line 2, in initialize
File "/home/carlos/anaconda3/lib/python3.5/site-packages/traitlets/config/application.py", line 74, in catch_config_error
return method(app, *args, **kwargs)
File "/home/carlos/anaconda3/lib/python3.5/site-packages/notebook/notebookapp.py", line 1023, in initialize
self.init_webapp()
File "/home/carlos/anaconda3/lib/python3.5/site-packages/notebook/notebookapp.py", line 882, in init_webapp
xheaders=self.trust_xheaders)
File "/home/carlos/anaconda3/lib/python3.5/site-packages/tornado/util.py", line 221, in __new__
instance.initialize(*args, **init_kwargs)
File "/home/carlos/anaconda3/lib/python3.5/site-packages/tornado/httpserver.py", line 155, in initialize
read_chunk_size=chunk_size)
File "/home/carlos/anaconda3/lib/python3.5/site-packages/tornado/tcpserver.py", line 112, in __init__
self.ssl_options['certfile'])
ValueError: certfile "jupnb.pem" does not exist
The certfile actually exists, in the directory ~/.jupyter/
I haven't been lucky googling the solution. Any comments?
Thanks!
Carlos
edit ~/.jupyter/jupyter_notebook_config.py and check the correct paths,
e.g. for ~/.jupyter/jupnb.key and ~/.jupyter/jupnb.pem:
import os
c.NotebookApp.keyfile = os.path.expanduser('~') + '/.jupyter/jupnb.key'
c.NotebookApp.certfile = os.path.expanduser('~') + '/.jupyter/jupnb.pem'

Resources