After hours of searching and trial and error, I finally decided to ask you guys for help.
As I'm trying to call some functions from a .NET 6 open source project from python, I installed python3.8.4 on my raspberry pi and managed to install the pythonnet 3.0.0 module.
my app.runtime.json is the following:
{
"runtimeOptions": {
"tfm": "net6.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "6.0.102"
}
}
}
and when I try to load the CLR like this:
from clr_loader import get_coreclr
from pythonnet import set_runtime
rt = get_coreclr("app.runtime.json")
set_runtime(rt)
import sys
I get the following error message:
RuntimeError Traceback (most recent call
last) Input In [11], in
1 from clr_loader import get_coreclr
2 from pythonnet import set_runtime
----> 4 rt = get_coreclr("app.runtime.json")
5 set_runtime(rt)
6 import sys
File ~/.local/lib/python3.8/site-packages/clr_loader/init.py:42,
in get_coreclr(runtime_config, dotnet_root, properties)
39 from .hostfxr import DotnetCoreRuntime
41 if dotnet_root is None:
---> 42 dotnet_root = find_dotnet_root()
44 impl = DotnetCoreRuntime(runtime_config=runtime_config, dotnet_root=dotnet_root)
45 if properties:
File ~/.local/lib/python3.8/site-packages/clr_loader/util/find.py:22,
in find_dotnet_root()
20 dotnet_path = shutil.which("dotnet")
21 if not dotnet_path:
---> 22 raise RuntimeError("Can not determine dotnet root")
24 try:
25 # Pypy does not provide os.readlink right now
26 if hasattr(os, "readlink"):
RuntimeError: Can not determine dotnet root
I exported the path to my dotnet 6.0 sdk to PATH and when I use "dotnet --version" it prints out 6.0.102.
What can I possibly have done wrong?
Thanks in advance,
Epi
Related
I'm trying to use https://github.com/uber/orbit. I have the package installed without errors as far as I can see.
I can run everything just fine in my terminal on my mac. However, I load up vs-code and try and run there and I receive the error below. I can't figure out what the problem is or how to configure my vs-code to avoid this issue.
This causes the following error. NO issues in terminal.
from orbit.utils.dataset import load_iclaims
from orbit.models import DLT
from orbit.diagnostics.plot import plot_predicted_data
My python version is 3.9.15 that I am running this in both in terminal and in vs-code.
If anyone has an idea, can you please be specific on steps on how to fix this, as I have been hunting in vscode for a while and can't figure it out why I don't have this issue in terminal, but only in VSCODE
OperationalError Traceback (most recent call last)
Cell In[3], line 1
----> 1 from orbit.models import DLT
File ~/opt/anaconda3/lib/python3.9/site-packages/orbit/__init__.py:3
1 __all__ = ["satellite", "tle", "utilities"]
----> 3 from .satellite import satellite
File ~/opt/anaconda3/lib/python3.9/site-packages/orbit/satellite.py:3
1 from math import degrees
----> 3 from . import tle, utilities
5 class satellite:
6 def __init__(self,catnr):
File ~/opt/anaconda3/lib/python3.9/site-packages/orbit/tle.py:10
6 import ephem
8 from . import utilities
---> 10 requests_cache.install_cache(expire_after=86400)
12 def get(catnr):
13 page = html.fromstring(requests.get('http://www.celestrak.com/cgi-bin/TLE.pl?CATNR=%s' % catnr).text)
File ~/opt/anaconda3/lib/python3.9/site-packages/requests_cache/patcher.py:48, in install_cache(cache_name, backend, expire_after, urls_expire_after, allowable_codes, allowable_methods, filter_fn, stale_if_error, session_factory, **kwargs)
23 def install_cache(
24 cache_name: str = 'http_cache',
...
--> 168 self._local_context.con = sqlite3.connect(self.db_path, **self.connection_kwargs)
169 if self.fast_save:
170 self._local_context.con.execute('PRAGMA synchronous = 0;')
OperationalError: unable to open database file
I'm having trouble importing nglview inside a Juypter Notebook (JNb) cell. The instance of JNb is started via the base (root) Environment inside Anaconda.Navigator GUI. Inside Anaconda.Navigator, I've installed nglview. But the import continues to fail.
Versions:
Jupyter Notebook (inside Anaconda.Navigator) - 6.4.12
Anaconda.Navigator (GUI) - 2.3.2
Python - 3.9
nglview - 3.0.3 (installed but not importing)
ipython 8.5.0
This is the error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In [1], line 5
3 import pandas as pd
4 import matplotlib.pyplot as plt
----> 5 import nglview as nv
7 # the next line is necessary to display plots in Jupyter
8 get_ipython().run_line_magic('matplotlib', 'inline')
File ~\anaconda3\lib\site-packages\nglview\__init__.py:4
1 import warnings
3 # for doc
----> 4 from . import adaptor, datafiles, show, widget
5 from ._version import get_versions
6 from .adaptor import *
File ~\anaconda3\lib\site-packages\nglview\show.py:13
3 from . import datafiles
4 from .adaptor import (ASEStructure, ASETrajectory, BiopythonStructure,
5 FileStructure, HTMDTrajectory, IODataStructure,
6 IOTBXStructure, MDAnalysisTrajectory, MDTrajTrajectory,
(...)
11 RdkitStructure,
12 TextStructure)
---> 13 from .widget import NGLWidget
15 __all__ = [
16 'demo',
17 'show_pdbid',
(...)
40 'show_biopython',
41 ]
44 def show_pdbid(pdbid, **kwargs):
File ~\anaconda3\lib\site-packages\nglview\widget.py:19
15 from traitlets import (Bool, CaselessStrEnum, Dict, Instance, Int, Integer,
16 List, Unicode, observe, validate)
17 import traitlets
---> 19 from . import color, interpolate
20 from .adaptor import Structure, Trajectory
21 from .component import ComponentViewer
File ~\anaconda3\lib\site-packages\nglview\color.py:114
110 else:
111 raise ValueError(f"{obj} must be either list of list or string")
--> 114 ColormakerRegistry = _ColormakerRegistry()
File ~\anaconda3\lib\site-packages\nglview\base.py:10, in _singleton.<locals>.getinstance()
8 def getinstance():
9 if cls not in instances:
---> 10 instances[cls] = cls()
11 return instances[cls]
File ~\anaconda3\lib\site-packages\nglview\color.py:47, in _ColormakerRegistry.__init__(self, *args, **kwargs)
45 try:
46 get_ipython() # only display in notebook
---> 47 self._ipython_display_()
48 except NameError:
49 pass
File ~\anaconda3\lib\site-packages\nglview\color.py:54, in _ColormakerRegistry._ipython_display_(self, **kwargs)
52 if self._ready:
53 return
---> 54 super()._ipython_display_(**kwargs)
AttributeError: 'super' object has no attribute '_ipython_display_'
What is missing? I need to resolve this issue within the GUI of Anaconda.Navigator, as I need nglview as part of an exercise for students who do not have a background in computational sciences. I'm not after a solution that uses anything but the GUI. Asking a group over Zoom to start hacking around with a Mac/Windows/Linux terminal would be a nightmare. Many thanks.
UPDATE
Recent efforts have included:
closing and restarting Anaconda.Navigator GUI
"Quit" the Jupyter server (option found in the browser tab). Restarted the server.
%conda install -c conda-forge nglview at the top of the Notebook. It just informs me that it's already installed.
Closing the tab and all mentions of Anaconda and Jupyter (but not the browser window instance itself).
The fact that I haven't restarted the machine itself is a big grey elephant. Unfortunately, it's running a long Quantum chemistry calculation in the background that can't be continued after boot :-( Sorry. But I don't want to get hung up on restarting a machine - it shouldn't come down to that.
Check whether the version of ipywidget in your current conda version is above 8.0.0. Because Jupyter notebook is not compatible with the new version of ipywidget. Thus try the command below to install the older version of ipywidget, then ǹglview` should be properly imported:
conda install "ipywidgets <8" -c conda-forge
I'm trying to set up a GluonCV in a jupyter notebook in a virtual environment. For some reason whenever I try to import GluonCV I get this error:
ImportError Traceback (most recent call last)
<ipython-input-2-9a2bc396118f> in <module>
----> 1 import gluoncv
~\anaconda3\envs\mxnet\lib\site-packages\gluoncv\__init__.py in <module>
10 _require_mxnet_version('1.4.0', '2.0.0')
11
---> 12 from . import data
13 from . import model_zoo
14 from . import nn
~\anaconda3\envs\mxnet\lib\site-packages\gluoncv\data\__init__.py in <module>
29 from .sampler import SplitSampler, ShuffleSplitSampler
30 from .otb.tracking import OTBTracking
---> 31 from .kitti.kitti_dataset import KITTIRAWDataset, KITTIOdomDataset
32
33 datasets = {
~\anaconda3\envs\mxnet\lib\site-packages\gluoncv\data\kitti\__init__.py in <module>
1 # pylint: disable=missing-module-docstring
----> 2 from .kitti_dataset import *
3 from .kitti_utils import *
~\anaconda3\envs\mxnet\lib\site-packages\gluoncv\data\kitti\kitti_dataset.py in <module>
19
20 from ...utils.filesystem import try_import_skimage
---> 21 from .kitti_utils import generate_depth_map
22 from .mono_dataset import MonoDataset
23
~\anaconda3\envs\mxnet\lib\site-packages\gluoncv\data\kitti\kitti_utils.py in <module>
10
11 import mxnet as mx
---> 12 from mxnet.util import is_np_array
13
14
ImportError: cannot import name 'is_np_array'
I've tried using the same files that work on Google Collaboratory but I still get that error. I've tried reinstalling gluon and all that stuff in all manners. No idea what's going on. For convenience I really need this to work.
I resolved this error by installing the compatible versions of mxnet and gluoncv.In my case I had installed mxnet with with gluoncv native, that resolved the error.
I run this simple code on google colab.
###cell 1 : `!pip install syft`
###cell 2 : `import syft as sy`
and i got this error :
ModuleNotFoundError: No module named 'syft_proto.messaging.v1.protocol_pb2'
There is the full error message
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-3-9aeadc8ee442> in <module>()
----> 1 import syft as sy
7 frames
/usr/local/lib/python3.6/dist-packages/syft/__init__.py in <module>()
41
42 # Import grids
---> 43 from syft.grid.private_grid import PrivateGridNetwork
44 from syft.grid.public_grid import PublicGridNetwork
45
/usr/local/lib/python3.6/dist-packages/syft/grid/private_grid.py in <module>()
9 # Syft imports
10 from syft.grid.abstract_grid import AbstractGrid
---> 11 from syft.workers.node_client import NodeClient
12 from syft.messaging.plan.plan import Plan
13 from syft.frameworks.torch.tensors.interpreters.additive_shared import AdditiveSharingTensor
/usr/local/lib/python3.6/dist-packages/syft/workers/node_client.py in <module>()
5
6 # Syft imports
----> 7 from syft.serde import serialize
8 from syft.messaging.plan import Plan
9 from syft.codes import REQUEST_MSG, RESPONSE_MSG
/usr/local/lib/python3.6/dist-packages/syft/serde/__init__.py in <module>()
----> 1 from syft.serde.serde import *
/usr/local/lib/python3.6/dist-packages/syft/serde/serde.py in <module>()
10 from syft.workers.abstract import AbstractWorker
11
---> 12 from syft.serde import msgpack
13
14 ## SECTION: High Level Public Functions (these are the ones you use)
/usr/local/lib/python3.6/dist-packages/syft/serde/msgpack/__init__.py in <module>()
----> 1 from syft.serde.msgpack import serde
2 from syft.serde.msgpack import native_serde
3 from syft.serde.msgpack import torch_serde
4 from syft.serde.msgpack import proto
5
/usr/local/lib/python3.6/dist-packages/syft/serde/msgpack/serde.py in <module>()
57 from syft.messaging.plan import Plan
58 from syft.messaging.plan.state import State
---> 59 from syft.messaging.protocol import Protocol
60 from syft.messaging.message import Message
61 from syft.messaging.message import Operation
/usr/local/lib/python3.6/dist-packages/syft/messaging/protocol.py in <module>()
11 from syft.workers.abstract import AbstractWorker
12 from syft.workers.base import BaseWorker
---> 13 from syft_proto.messaging.v1.protocol_pb2 import Protocol as ProtocolPB
14
15
ModuleNotFoundError: No module named 'syft_proto.messaging.v1.protocol_pb2'
Hope that you can help me. Thank you
Thank you for answers. It works when i downgrade these two packages, it is a temporary problem due to pysyft developers.
!pip install syft=="0.2.2a1"
!pip install syft_proto=="0.1.1a1.post17"
It looks the module you are trying to use is either deprecated or has a new version. See here the file is not active.
Try searching if a newer version of this protocol exists or any similar protocol that can cater to your needs.
Edit:
It may also be that you are using an older version Syft and so I recommend you to upgrade your pip and Syft. Follow the instructions here
you can upgrade both to their latest version which are kept compatible!
!pip install --upgrade syft
!pip install --upgrade syft_proto
I normally have no problem scouring the web for obscure python packages. However I cannot find this one. Does anyone know what the error is referring too?
Is there an easy way to dig into the source to figure out what modules it wants?
I know I shouldn't be bugging stackoverflow about every missing module I have so is there a method for debugging this myself?
These are the modules i've most recently installed for this project:
blist
beautifulsoup
requests
pymongo
SQLAlchemy
xmltodict
financial_fundamentals
I think the error is coming from SQLAlchemy but the error readout says something about vector_cache
Using the following line:
import financial_fundamentals.accounting_metrics as ac
I get:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-6-f1aecf47aa1b> in <module>()
----> 1 import financial_fundamentals.accounting_metrics as ac
C:\Python27\lib\site-packages\financialfundamentals-0.2.3-py2.7.egg\financial_fundamentals\accounting_metrics.py in <module>()
65 import financial_fundamentals.edgar as edgar
66
---> 67 #vector_cache.vector_cache
68 def earnings_per_share(required_data):
69 start, end = required_data.index[0], required_data.index[-1]
C:\Python27\lib\site-packages\vector_cache-0.1.0-py2.7.egg\vector_cache\_vector_cache.pyc in vector_cache(user_function)
19 # When the function name or location changes you're going to have to re-cache everything, bummer.
20 metric = user_function.__name__
---> 21 data_store = get_data_store()
22 #wraps(user_function)
23 def wrapper(required_data_df):
C:\Python27\lib\site-packages\vector_cache-0.1.0-py2.7.egg\vector_cache\__init__.py in _get_data_store(cls)
37 except IOError:
38 # no config in home directory
---> 39 return cls._default_data_store(db_dir=home)
40 else:
41 return cls._eval_config_code(code)
C:\Python27\lib\site-packages\vector_cache-0.1.0-py2.7.egg\vector_cache\__init__.py in _default_data_store(db_dir)
43 #staticmethod
44 def _default_data_store(db_dir):
---> 45 from sql_driver import SQLDataStore
46 import os
47 db_file_path = os.path.join(db_dir, 'vector_cache.db')
ImportError: No module named sql_driver