Virtual serial SPI port WSL2 - raspberry-pi

i am using a Python module for a LED strip (APA102), that communicates over my Raspberry Pi's SPI pins. When I execute scripts on my WSL2 locally (since I don't have my Pi always with me), i get an exception when trying to import the apa102_pi module with the following traceback:
WARNING: GENERIC_X86 is not fully supported. Some features may not work.
WARNING: GENERIC_X86 is not fully supported. Some features may not work.
Traceback (most recent call last):
File "/home/michael/.pyenv/versions/apa_env/bin/apa102_server", line 33, in <module>
sys.exit(load_entry_point('michaelstuffer98.apa102-tcp-server==0.0.0', 'console_scripts', 'apa102_server')())
File "/home/michael/.pyenv/versions/apa_env/bin/apa102_server", line 25, in importlib_load_entry_point
return next(matches).load()
File "/home/michael/.pyenv/versions/3.9.15/lib/python3.9/importlib/metadata.py", line 86, in load
module = import_module(match.group('module'))
File "/home/michael/.pyenv/versions/3.9.15/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/home/michael/.pyenv/versions/3.9.15/envs/apa_env/lib/python3.9/site-packages/apa102_tcp_server/led_audio_controller.py", line 3, in <module>
from apa102_tcp_server.apa_led import LedStrip
File "/home/michael/.pyenv/versions/3.9.15/envs/apa_env/lib/python3.9/site-packages/apa102_tcp_server/apa_led.py", line 1, in <module>
from apa102_pi.driver import apa102
File "/home/michael/.pyenv/versions/3.9.15/envs/apa_env/lib/python3.9/site-packages/apa102_pi/driver/apa102.py", line 10, in <module>
from microcontroller.pin import spiPorts
ImportError: cannot import name 'spiPorts' from 'microcontroller.pin' (/home/michael/.pyenv/versions/3.9.15/envs/apa_env/lib/python3.9/site-packages/microcontroller/pin.py)
This happens imo because I don't have serial pins available. I already worked with pseudo-terminals before, is it possible to create a workaround with that, or is there another a possibility to create this interface virtually? I actually don't really need the functionality (still would be nice to have that too), but only want to make importing the module work.

Related

ImportError: cannot import name 'ranked_blast_output_schema' from 'param'

I am just getting started on Python, though I know a bit of R. I want to replicate something someone has already done. I am receiving this error on one of my kernels on Jupyter and I don't immediately know what to do about it. Does anyone have any input or experience with it?
Traceback (most recent call last):
File "parse.py", line 8, in <module>
from param import ranked_blast_output_schema, blast_outfmt6_schema
ImportError: cannot import name 'ranked_blast_output_schema' from 'param' (/Users/myaccount/miniconda3/lib/python3.8/site-packages/param/__init__.py)
Traceback (most recent call last):
File "lca_analysis.py", line 52, in <module>
if ("~" in blast_results["query"].iloc[0]):
File "/Users/myaccount/miniconda3/lib/python3.8/site-packages/pandas/core/indexing.py", line 894, in __getitem__
return self._getitem_axis(maybe_callable, axis=axis)
File "/Users/myaccount/miniconda3/lib/python3.8/site-packages/pandas/core/indexing.py", line 1500, in _getitem_axis
self._validate_integer(key, axis)
File "/Users/myaccount/miniconda3/lib/python3.8/site-packages/pandas/core/indexing.py", line 1443, in _validate_integer
raise IndexError("single positional indexer is out-of-bounds")
IndexError: single positional indexer is out-of-bounds
Ah okay. I am replicating a Jupyter notebook and I was told to run this link on bash.
lca_analysis.py --blast_type nt --fpath s3://org_name/contigs/CMS001_002_Ra_S1/blast_nt.m9 --filtered_blast_path s3://bucket_name/contig_quality/CMS001_002_Ra_S1/blast_nt_filtered.m9 --excluded_contigs_path s3://bucket_name/contig_quality/CMS001_002_Ra_S1/exclude_contigs_nt.txt --outpath s3://bucket_name/contig_quality/CMS001_002_Ra_S1/lca_nt.m9 --read_count_path s3://bucket_name/contigs/CMS001_002_Ra_S1/contig_stats.json --verbose True
But then, I had this error
Read counts have been loaded: s3://bucket_name/contigs/CMS001_002_Ra_S1/contig_stats.json| elapsed time: 0.73 seconds
/var/folders/ns/gdtc2hvx1g13_29wct4qkhd80000gq/T/tmp3m3k6w9o blast file downloaded to this tempfile
Traceback (most recent call last):
File "parse.py", line 8, in <module>
from param import ranked_blast_output_schema, blast_outfmt6_schema
ImportError: cannot import name 'ranked_blast_output_schema' from 'param' (/Users/myaccount/miniconda3/lib/python3.8/site-packages/param/__init__.py)
Traceback (most recent call last):
File "lca_analysis.py", line 52, in <module>
if ("~" in blast_results["query"].iloc[0]):
File "/Users/myaccount/miniconda3/lib/python3.8/site-packages/pandas/core/indexing.py", line 894, in __getitem__
return self._getitem_axis(maybe_callable, axis=axis)
File "/Users/myaccount/miniconda3/lib/python3.8/site-packages/pandas/core/indexing.py", line 1500, in _getitem_axis
self._validate_integer(key, axis)
File "/Users/myaccount/miniconda3/lib/python3.8/site-packages/pandas/core/indexing.py", line 1443, in _validate_integer
raise IndexError("single positional indexer is out-of-bounds")
IndexError: single positional indexer is out-of-bounds
I had just used pip install param to get param, and the install went just fine.

What to do to import a CSV file using a chromebook idle version python 3.7.3 shell

Keep getting this error message when I enter this code :
data = pd.read_csv('1.01. Simple linear regression.csv')
Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
data = pd.read_csv('1.01. Simple linear regression.csv')
File "/usr/lib/python3/dist-packages/pandas/io/parsers.py", line 678, in parser_f
return _read(filepath_or_buffer, kwds)
File "/usr/lib/python3/dist-packages/pandas/io/parsers.py", line 440, in _read
parser = TextFileReader(filepath_or_buffer, **kwds)
File "/usr/lib/python3/dist-packages/pandas/io/parsers.py", line 787, in __init__
self._make_engine(self.engine)
File "/usr/lib/python3/dist-packages/pandas/io/parsers.py", line 1014, in _make_engine
self._engine = CParserWrapper(self.f, **self.options)
File "/usr/lib/python3/dist-packages/pandas/io/parsers.py", line 1708, in __init__
self._reader = parsers.TextReader(src, **kwds)
File "pandas/_libs/parsers.pyx", line 384, in pandas._libs.parsers.TextReader.__cinit__
File "pandas/_libs/parsers.pyx", line 695, in pandas._libs.parsers.TextReader._setup_parser_source
And the message :
FileNotFoundError: File b'1.01. Simple linear regression.csv' does not exist
(Best end a question with the question.) The current working directory for the program does not have a file by that name. Possible solutions:
Give a complete path to the file to read_csv.
Change the working directory in the program to the one that contain that file using os.chdir. See chdir doc.
Start python in that directory, with or without IDLE, from a command line.

odoo.service.server: Failed to load server-wide module `web`

I am getting this error during starting the server after installation of odoo 11.
I am using ubuntu 18.04
my config file is like this
*
[options]
; This is the password that allows database operations:
;admin_passwd = admin
db_host = 127.0.0.1
db_port = 8069
db_user = odoo
db_password = 123
addons_path = /opt/odoo/addons,/opt/odoo/odoo/addons
logfile = /var/log/odoo/odoo-server.log
*
Full error is something like this
2020-02-07 05:12:33,809 12706 CRITICAL ? odoo.modules.module: Couldn't load module web
2020-02-07 05:12:33,809 12706 CRITICAL ? odoo.modules.module: The 'odoo.addons.web' package was not installed in a way that PackageLoader understands.
2020-02-07 05:12:33,809 12706 ERROR ? odoo.service.server: Failed to load server-wide module `web`.
The `web` module is provided by the addons found in the `openerp-web` project.
Maybe you forgot to add those addons in your addons_path configuration.
Traceback (most recent call last):
File "/opt/odoo/odoo/service/server.py", line 984, in load_server_wide_modules
odoo.modules.module.load_openerp_module(m)
File "/opt/odoo/odoo/modules/module.py", line 368, in load_openerp_module
__import__('odoo.addons.' + module_name)
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "/opt/odoo/odoo/modules/module.py", line 82, in load_module
exec(open(modfile, 'rb').read(), new_mod.__dict__)
File "<string>", line 4, in <module>
File "/opt/odoo/addons/web/controllers/__init__.py", line 4, in <module>
from . import main, pivot
File "/opt/odoo/addons/web/controllers/main.py", line 56, in <module>
loader = jinja2.PackageLoader('odoo.addons.web', "views")
File "/home/sandip/.local/lib/python3.6/site-packages/jinja2/loaders.py", line 290, in __init__
" PackageLoader understands." % package_name
ValueError: The 'odoo.addons.web' package was not installed in a way that PackageLoader understands.
It's actually a bug inside Jinja2. Update it to version 2.11.2
You might be blocked by a missing parameter in your config file.
Try to add the following parameter in the file:
server_wide_modules = web
It is a requirement for the installation to go through peacefully.
Hope it helps
Please check your jinja version
maybe wrong with your version jinja
uninstall them
sudo pip3 uninstall Jinja2
then install with right version
sudo pip3 install Jinja2==2.10.1

"import matlab.engine" works on linux command line but not in Spyder

Matlab engine for python (r2016a) appears to be installed and working with python. I can do the following from a bash prompt:
$ python
Python 3.4.5 |Anaconda 4.3.1 (64-bit)| (default, Jul 2 2016, 17:47:47)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matlab.engine
>>> eng = matlab.engine.start_matlab()
>>> eng.abs(-1)
1
>>> exit()
Next I start Spyder (typing "spyder &" from the same bash prompt) and this is what I get trying the same thing from within Spyder:
Python 3.4.5 |Anaconda 4.3.1 (64-bit)| (default, Jul 2 2016, 17:47:47)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matlab.engine
Traceback (most recent call last):
File "/home/XXX/anaconda3/envs/mr2/lib/python3.4/site-packages/matlab/engine/__init__.py", line 42, in <module>
pythonengine = importlib.import_module("matlabengineforpython"+_PYTHONVERSION)
File "/home/XXX/anaconda3/envs/mr2/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked
ImportError: No module named 'matlabengineforpython3_4'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/XXX/anaconda3/envs/mr2/lib/python3.4/site-packages/matlab/engine/__init__.py", line 58, in <module>
pythonengine = importlib.import_module("matlabengineforpython"+_PYTHONVERSION)
File "/home/XXX/anaconda3/envs/mr2/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible
File "<frozen importlib._bootstrap>", line 539, in _check_name_wrapper
File "<frozen importlib._bootstrap>", line 1715, in load_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
ImportError: /opt/local/matlab2016a/extern/engines/python/dist/matlab/engine/glnxa64/../../../../../../../bin/glnxa64/libicuio.so.54: undefined symbol: _ZN6icu_5413UnicodeString9doReplaceEiiPKDsii
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/XXX/anaconda3/envs/mr2/lib/python3.4/site-packages/matlab/engine/__init__.py", line 61, in <module>
'MathWorks Technical Support for assistance: %s' % e)
OSError: Please reinstall MATLAB Engine for Python or contact MathWorks Technical Support for assistance: /opt/local/matlab2016a/extern/engines/python/dist/matlab/engine/glnxa64/../../../../../../../bin/glnxa64/libicuio.so.54: undefined symbol: _ZN6icu_5413UnicodeString9doReplaceEiiPKDsii
>>>
Using IPython instead of python gives similar results but with a less informative error. It's clear that Spyder can't find the module matlabengineforpython3_4 but I don't know where to go from there.
How can I get the MATLAB engine to work correctly from within spyder?
This issue might be due to an incompatibility between the libstdc++ shipped with MATLAB and the libstdc++ shipped with the system that the spyder was linked against.
"CXXABI_1.3.9 not found" error message indicates that the libstdc++.so.6 library that is included with MATLAB is missing ABI versions the system needs to draw graphical content.
This is caused because the version of this particular library packaged with MATLAB is older than the versions that come with newer Linux operating systems, which causes compatibility issues.
You can try the following workarounds:
Renaming the libstdc++.so.6 library file so that MATLAB cannot find it and is forced to use the system's version of the library. This file is located in matlabroot/sys/os/glnxa64 . Renaming it to libstdc++.so.6.old should suffice. (where "matlabroot" is root installation directory of MATLAB)
Forcing MATLAB to load the system version by setting the $LD_PRELOAD environment variable to the newer version of libstdc++.
Also, since you are trying to call an external program from MATLAB, this may be a third party issue. But, you can try setting the library paths correctly in 'LD_LIBRARY_PATH' system variable.
find / -name "libstdc++.so*"
I found that calling matlab with the command LD_PRELOAD=/usr/lib64/libstdc++.so.6 matlab -desktop seems to solve the issue
in order to avoid having to type this command every time I also assigned an alias on my .bashrc file alias matlab="LD_PRELOAD=/usr/lib64/libstdc++.so.6 /usr/local/bin/matlab -desktop"
https://cn.mathworks.com/matlabcentral/answers/329796-issue-with-libstdc-so-6

how to properly resolve gsutil error

I just installed gsutil on OS X, exactly following Google's instruction, and am seeing errors of the following format when running any gsutil command:
Traceback (most recent call last):
File "/Users//gsutil/gsutil", line 22, in <module>
gsutil.RunMain()
File "/Users//gsutil/gsutil.py", line 101, in RunMain
sys.exit(gslib.__main__.main())
File "/Users//gsutil/gslib/__main__.py", line 175, in main
command_runner = CommandRunner()
File "/Users//gsutil/gslib/command_runner.py", line 107, in __init__
self.command_map = self._LoadCommandMap()
File "/Users//gsutil/gslib/command_runner.py", line 113, in _LoadCommandMap
__import__('gslib.commands.%s' % module_name)
File "/Users//gsutil/gslib/commands/disablelogging.py", line 16, in <module>
from gslib.command import COMMAND_NAME
ImportError: cannot import name COMMAND_NAME
This error occurs on several modules in the commands directory. The only thing I could do to get rid of these errors is to remove the following modules from the directory which reference COMMAND_NAME: disablelogging, enablelogging, getacl, getcors, getdefacl, getlogging, setacl, setcors, setdefacl.
Did I do the right thing here? Is this a bug in gsutil?