julia.install() fails on python import error - python

I am trying to run a Julia script from python. I have Julia 1.6.4 installed (also tried 1.7.3) and installed pip install julia from Pycharm's terminal in the virtual environment. When importing julia and then running julia.install() I get the following error message:
I use Pycharm with a virtual environment with Python 3.9.7 for my project. However, I have also tried different python versions in different virtual environments or by using the base python installed. All give the same error.
Also, ~/.julia/packages/PyCall/*/deps/build.log does not exist for me.
[ Info: Trying to import PyCall...
Fatal Python error: init_import_size: Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\site.py", line 73, in <module>
import os
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\os.py", line 29, in <module>
from _collections_abc import _check_methods
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\_collections_abc.py", line 12, in <module>
GenericAlias = type(list[int])
TypeError: 'type' object is not subscriptable
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Users\<user>\PycharmProjects\<project>\venv\lib\site-packages\julia\tools.py", line 118, in install
raise PyCallInstallError("Installing", output)
julia.tools.PyCallInstallError: Installing PyCall failed.
** Important information from Julia may be printed before Python's Traceback **
Some useful information may also be stored in the build log file
`~/.julia/packages/PyCall/*/deps/build.log`.```

Julia needs to have PyCall installed
PyCall in Julia needs to be configured to use the same Python that you are using to call Julia from
For more information see this post:
I have a high-performant function written in Julia, how can I use it from Python?

Related

How do I install GNU Radio in a Python virtualenv

I am trying to get gnuradio to work in a virtualenv. I want to keep my system somewhat clean and my project needs Python 3.9, but my system Python is 3.8 (Ubuntu 20.04.4 LTS).
I install it using sudo apt install gnuradio, but then it ends up in the system dist-packages and I can't import it in my virtualenv. The imports work fine when running the system Python.
I have tried to recreate my virtualenv to use system packages:
python3.9 -m venv --system-site-packages venv
This at least made my virtualenv able to find gnuradio, but when I try importing stuff it fails in several different ways.
>>> from gnuradio import uhd
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/gnuradio/uhd/__init__.py", line 21, in _prepare_uhd_python
from . import uhd_python
ImportError: cannot import name 'uhd_python' from partially initialized module 'gnuradio.uhd' (most likely due to a circular import) (/usr/lib/python3/dist-packages/gnuradio/uhd/__init__.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/gnuradio/uhd/__init__.py", line 68, in <module>
_prepare_uhd_python()
File "/usr/lib/python3/dist-packages/gnuradio/uhd/__init__.py", line 26, in _prepare_uhd_python
from . import uhd_python
ImportError: cannot import name 'uhd_python' from partially initialized module 'gnuradio.uhd' (most likely due to a circular import) (/usr/lib/python3/dist-packages/gnuradio/uhd/__init__.py)
>>> import pmt
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pmt/__init__.py", line 34, in <module>
from .pmt_python import *
ModuleNotFoundError: No module named 'pmt.pmt_python'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/pmt/__init__.py", line 38, in <module>
from .pmt_python import *
ModuleNotFoundError: No module named 'pmt.pmt_python'
I have struggled with this for several days now and found no solution. Is it even possible to run GNU Radio from within a virtualenv?
I have struggled with this for several days now and found no solution.
Your distro's GNU Radio package is built against your distro's python, so you can't use it with a different python.
So, this is expected.
Is it even possible to run GNU Radio from within a virtualenv?
Sure, you'd need to build it from that virtualenv as well, and tell cmake -DCMAKE_INSTALL_PREFIX=/path/to/virtualenv/ to install into it.
We have a pretty nice anaconda packager, so installing GNU Radio into a Python prefix using conda might be the easiest alternative to that.
Alternatively:
Ubuntu 20.04.4 LTS
There's a new Ubuntu LTS version out! If you go for a system upgrade to Ubuntu 22.04 LTS, you get Python 3.10, and a current GNU Radio 3.10.1 "for free".

Having trouble with the aiy-python-wheels on Raspberry Pi 3. How do I resolve incompatible glibc issue?

I've gotten my hands on a AIY voice kit v1 and am stuck with the assistant_grpc_demo.py with it failing at an import statement with the grpc. I should have everything installed already, yet google.auth.transport can't seem to find it. I am using a pi 3 A+. Below is the terminal commands I used and their outputs.
pi#raspberrypi:~ $ cat testinput.py
import google.auth.transport.grpc
pi#raspberrypi:~ $ python3 testinput.py
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.7/site-packages/google/auth/transport/grpc.py", line 30, in <module>
import grpc
File "/home/pi/.local/lib/python3.7/site-packages/grpc/__init__.py", line 22, in <module>
from grpc import _compression
File "/home/pi/.local/lib/python3.7/site-packages/grpc/_compression.py", line 15, in <module>
from grpc._cython import cygrpc
ImportError: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.33' not found (required by /home/pi/.local/lib/python3.7/site-packages/grpc/_cython/cygrpc.cpython-37m-arm-linux-gnueabihf.so)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "testinput.py", line 1, in <module>
import google.auth.transport.grpc
File "/home/pi/.local/lib/python3.7/site-packages/google/auth/transport/grpc.py", line 37, in <module>
caught_exc,
File "<string>", line 3, in raise_from
ImportError: gRPC is not installed, please install the grpcio package to use the gRPC transport.
*Maybe the glibc part is the problem. Not sure how to resolve that as I already have libc6 2.28. Is there a way to get the aiy-python-wheels to work with my set-up or a previous version. Already tried flashing a pre-built official image built on 4-13-2018 with everything set up, though it failed to boot. Trying to download all packages manually. assistant_library_with_button.sh works though.
Not sure how to resolve that as I already have libc6 2.28
The error message says: .../site-packages/grpc/_cython/cygrpc.cpython-37m-arm-linux-gnueabihf.so requires GLIBC_2.33.
Your libc6 is too old for that gRPC package to work -- it was compiled on a newer system.
You must either:
get a different gRPC package -- one compiled on and suitable for running on a GLIBC-2.28 (or earlier) based system, or
get a different GLIBC package (2.33 or later).

Error while attempting to import openai's universe

While importing openai's universe, i get these errors:
Traceback (most recent call last):
File "/Users/calvin/Desktop/universe-test/main.py", line 2, in <module>
import universe
File "/Users/calvin/universe/universe/__init__.py", line 22, in <module>
from universe import error, envs
File "/Users/calvin/universe/universe/envs/__init__.py", line 1, in <module>
import universe.envs.vnc_env
File "/Users/calvin/universe/universe/envs/vnc_env.py", line 11, in <module>
from universe.envs import diagnostics
File "/Users/calvin/universe/universe/envs/diagnostics.py", line 94
async = self.qr_pool.apply_async(self.method, (self._last_img, time.time(), available_at))
^
SyntaxError: invalid syntax
I've tried downloading a different version of gym, reinstalling universe, and nothing works. I have python 3.8.5 64-bit. My operating system is macOS Catalina 10.15.6. Any ideas?
async is now a special keyword, and as such, can't be used as a variable name.
That library appears to be made for Python pre-3.5. I believe your only options are:
Use a older version of Python 3 (async was intrduced in 3.5).
Edit the local copy of the library file to change the name to something else.
Check to see if there are any updates/forks to the library that fix that issue.

How to reinstall or fix Python interpreter for XCode lldb?

I got this message at XCode after deleting some system files.
(lldb) script
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'run_python_interpreter' is not defined
P.S. Had to reinstall XCode, but I've got same message at debugger after reinstalling IDE
Terminal output
$ lldb
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/usr/local/Cellar/python#2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 52, in <module>
import weakref
File "/usr/local/Cellar/python#2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/weakref.py", line 14, in <module>
from _weakref import (
ImportError: cannot import name _remove_dead_weakref
You have a local installation of python on your computer (in /usr/local/Cellar). There's a problem when you have two different pythons on your system; lldb links against /System/Library/Frameworks/Python.framework but that python somehow ends up using the python libraries from your installed copy instead. I saw someone work around this once but I forget if it was by putting their local python last in $PATH or if they un-set their $PYTHONPATH before starting lldb.

Can't find submodule in package

I'm using Anaconda3 version 4.2.0 on ubuntu (in docker).
Anaconda is installed in /root/anaconda3 folder.
I installed theano_bpr package using pip install theano_bpr.
Now when i open python and try import theano_bpr, i get the following message:
>>> import theano_bpr
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/root/anaconda3/lib/python3.5/site-packages/theano_bpr/__init__.py", line 17, in <module>
from bpr import BPR
ImportError: No module named 'bpr'
However, when i navigate to /root/anaconda3/lib/python3.5/site-packages/theano_bpr/ and run python there, i'm able to import theano_bpr.
In /root/anaconda3/lib/python3.5/site-packages/theano_bpr/ there are following files:
__init__.py, bpr.py (this one is causing problems), t.py, and utils.py.

Categories

Resources