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
Related
I am working on deep learing project so for that I wanted to import tensorflow library but when I run the code cell in the jupyter notebook it pops up the following error.
Importing tensforflow library error screenshot
Importing tensforflow library error screenshot continue
import tensorflow as tf
error
AttributeError Traceback (most recent call last)
Cell In[3], line 1
----> 1 import tensorflow as tf
File ~\anaconda3\lib\site-packages\tensorflow\__init__.py:469
467 if hasattr(_current_module, "keras"):
468 try:
--> 469 _keras._load()
470 except ImportError:
471 pass
File ~\anaconda3\lib\site-packages\tensorflow\python\util\lazy_loader.py:41, in LazyLoader._load(self)
39 """Load the module and insert it into the parent's globals."""
40 # Import the target module and insert it into the parent's namespace
---> 41 module = importlib.import_module(self.__name__)
42 self._parent_module_globals[self._local_name] = module
44 # Emit a warning if one was specified
File ~\anaconda3\lib\importlib\__init__.py:127, in import_module(name, package)
125 break
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)
File ~\anaconda3\lib\site-packages\keras\__init__.py:21
15 """Implementation of the Keras API, the high-level API of TensorFlow.
16
17 Detailed documentation and user guides are available at
18 [keras.io](https://keras.io).
19 """
20 from keras import distribute
---> 21 from keras import models
22 from keras.engine.input_layer import Input
23 from keras.engine.sequential import Sequential
File ~\anaconda3\lib\site-packages\keras\models\__init__.py:18
1 # Copyright 2022 The TensorFlow Authors. All Rights Reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
(...)
13 # limitations under the License.
14 # ==============================================================================
15 """Keras models API."""
---> 18 from keras.engine.functional import Functional
19 from keras.engine.sequential import Sequential
20 from keras.engine.training import Model
File ~\anaconda3\lib\site-packages\keras\engine\functional.py:34
32 from keras.engine import input_spec
33 from keras.engine import node as node_module
---> 34 from keras.engine import training as training_lib
35 from keras.engine import training_utils
36 from keras.saving.legacy import serialization
File ~\anaconda3\lib\site-packages\keras\engine\training.py:45
43 from keras.saving.experimental import saving_lib
44 from keras.saving.legacy import hdf5_format
---> 45 from keras.saving.legacy import save
46 from keras.saving.legacy import saving_utils
47 from keras.saving.legacy import serialization
File ~\anaconda3\lib\site-packages\keras\saving\legacy\save.py:24
22 from keras.saving.legacy import serialization
23 from keras.saving.legacy.saved_model import load as saved_model_load
---> 24 from keras.saving.legacy.saved_model import load_context
25 from keras.saving.legacy.saved_model import save as saved_model_save
26 from keras.utils import traceback_utils
File ~\anaconda3\lib\site-packages\keras\saving\legacy\saved_model\load_context.py:68
64 """Returns whether under a load context."""
65 return _load_context.in_load_context()
---> 68 tf.__internal__.register_load_context_function(in_load_context)
AttributeError: module 'tensorflow._api.v2.compat.v2.__internal__' has no attribute 'register_load_context_function'
I am expecting such explanation which can easily be understood and even a beginner can interpret the solution.
You have an incompatible version of keras installed.
Uninstall it with pip uninstall keras and try again.
The Keras API is available within Tensorflow itself if you need it; from tensorflow import keras.
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
I received a ipython notebook file with the following code and I'm attempting to execute it via Jupyter.
import docx;
from django.utils.encoding import smart_text;
doc = docx.Document('test_file.docx')
I get the following traceback
---------------------------------------------------------------------------
PackageNotFoundError Traceback (most recent call last)
<ipython-input-8-2ff3b55810a7> in <module>()
1 import docx;
2 from django.utils.encoding import smart_text;
----> 3 doc = docx.Document('test_file.docx')
4 statements = [para.text.strip() for para in doc.paragraphs
5 if para.text.strip() != '']
C:\Program Files (x86)\Anaconda2\lib\site-packages\docx\api.pyc in Document(docx)
23 """
24 docx = _default_docx_path() if docx is None else docx
---> 25 document_part = Package.open(docx).main_document_part
26 if document_part.content_type != CT.WML_DOCUMENT_MAIN:
27 tmpl = "file '%s' is not a Word file, content type is '%s'"
C:\Program Files (x86)\Anaconda2\lib\site-packages\docx\opc\package.pyc in open(cls, pkg_file)
114 *pkg_file*.
115 """
--> 116 pkg_reader = PackageReader.from_file(pkg_file)
117 package = cls()
118 Unmarshaller.unmarshal(pkg_reader, package, PartFactory)
C:\Program Files (x86)\Anaconda2\lib\site-packages\docx\opc\pkgreader.pyc in from_file(pkg_file)
30 Return a |PackageReader| instance loaded with contents of *pkg_file*.
31 """
---> 32 phys_reader = PhysPkgReader(pkg_file)
33 content_types = _ContentTypeMap.from_xml(phys_reader.content_types_xml)
34 pkg_srels = PackageReader._srels_for(phys_reader, PACKAGE_URI)
C:\Program Files (x86)\Anaconda2\lib\site-packages\docx\opc\phys_pkg.pyc in __new__(cls, pkg_file)
29 else:
30 raise PackageNotFoundError(
---> 31 "Package not found at '%s'" % pkg_file
32 )
33 else: # assume it's a stream and pass it to Zip reader to sort out
PackageNotFoundError: Package not found at 'test_file.docx'
I uninstalled docx and reinstalled python-docx recently and wondering if that's related, or is this a separate issue?
This means that the specified file ('test_file.docx') does not exist or is not a Word document.
Check that the path is correct and that you can open the document with Word (or LibreOffice or whatever).
You might be missing a path part of the filename. Sometimes it's tricky to know what Python considers the default directory, which is where it goes looking for a filename without a path.
I have a basic python script that starts with
import requests
from bs4 import BeautifulSoup
from datetime import datetime
import difflib
import re
When I run that first block via Hydrogen (with ctrlenter), I get an attribute error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-3-686486c241c8> in <module>()
----> 1 import requests
/home/amanda/.local/lib/python2.7/site-packages/requests/__init__.py in <module>()
51 # Attempt to enable urllib3's SNI support, if possible
52 try:
---> 53 from .packages.urllib3.contrib import pyopenssl
54 pyopenssl.inject_into_urllib3()
55 except ImportError:
/home/amanda/.local/lib/python2.7/site-packages/requests/packages/urllib3/contrib/pyopenssl.py in <module>()
91 }
92
---> 93 DEFAULT_SSL_CIPHER_LIST = util.ssl_.DEFAULT_CIPHERS
94
95 # OpenSSL will only write 16K at a time
AttributeError: 'module' object has no attribute 'DEFAULT_CIPHERS'AttributeError
'module' object has no attribute 'DEFAULT_CIPHERS'
But if I launch a python console, import requests works fine. What am I missing here?
I have the Enthought Canopy installed on my Ubuntu 14.04. I'm trying to run sample matplotlib programs (from the library's website). Every attempt of running the program makes the Canopy's command prompt display following message:
TypeError Traceback (most recent call last)
/home/guras/Canopy/appdata/canopy-1.4.1.1975.rh5-x86_64/lib/python2.7/site-packages/IPython/utils/py3compat.pyc in execfile(fname, *where)
202 else:
203 filename = fname
--> 204 __builtin__.execfile(filename, *where)
/home/guras/Python programy/pierwszy.py in <module>()
4 This example uses the Fahrenheit and Celsius scales.
5 """
----> 6 import matplotlib.pyplot as plt
7 import numpy as np
8
/home/guras/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/pyplot.py in <module>()
26 import matplotlib
27 import matplotlib.colorbar
---> 28 from matplotlib import style
29 from matplotlib import _pylab_helpers, interactive
30 from matplotlib.cbook import dedent, silent_list, is_string_like, is_numlike
/home/guras/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/style/__init__.py in <module>()
1 from __future__ import absolute_import
2
----> 3 from .core import use, context, available, library, reload_library
/home/guras/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/style/core.py in <module>()
147 # Load style library
148 # ==================
--> 149 _base_library = load_base_library()
150
151 library = None
/home/guras/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/style/core.py in load_base_library()
92 """Load style library defined in this package."""
93 library = dict()
---> 94 library.update(read_style_directory(BASE_LIBRARY_PATH))
95 return library
96
/home/guras/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/style/core.py in read_style_directory(style_dir)
125 styles = dict()
126 for path, name in iter_style_files(style_dir):
--> 127 styles[name] = rc_params_from_file(path, use_default_template=False)
128 return styles
129
TypeError: **rc_params_from_file() got an unexpected keyword argument 'use_default_template'**
Any ideas how to fix it?
The use_default_template keyword parameter was added to the rc_params_from_file function in matplotlib version 1.4.0rc1.
Most likely, your version of matplotlib is older than 1.4.0rc1 and needs to be upgraded.
If you have more than one installation of matplotlib installed, you'll need to make sure the directory containing the newer version is listed earlier than the older version in sys.path, or perhaps, simply delete the older version of matplotlib.
Use the Canopy Package Manager to update matplotlib to the latest version.