I am trying to test the sphinx extension TODO from https://sphinx.readthedocs.io/en/master/development/tutorials/todo.html#writing-the-extension
However, this import "from docutils.parsers.rst import SphinxDirective" does not work, giving "Extension error:
Could not import extension todo (exception: No module named SphinxDirective)
"
I tried python2 and python3 , and readthedocs environment.
the code is here, https://www.sphinx-doc.org/en/master/development/tutorials/todo.html#writing-the-extension
ReadTheDocs gives this message:
Running Sphinx v1.8.5
loading translations [en]... done
Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/demo-sphinx-extensions-for-dirac/envs/latest/lib/python3.7/site-packages/sphinx/registry.py", line 472, in load_extension
mod = __import__(extname, None, None, ['setup'])
File "/home/docs/checkouts/readthedocs.org/user_builds/demo-sphinx-extensions-for-dirac/checkouts/latest/docs/todo.py", line 6, in <module>
from docutils.parsers.rst import SphinxDirective
ImportError: cannot import name 'SphinxDirective' from 'docutils.parsers.rst' (/home/docs/checkouts/readthedocs.org/user_builds/demo-sphinx-extensions-for-dirac/envs/latest/lib/python3.7/site-packages/docutils/parsers/rst/__init__.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/demo-sphinx-extensions-for-dirac/envs/latest/lib/python3.7/site-packages/sphinx/cmd/build.py", line 303, in build_main
args.tags, args.verbosity, args.jobs, args.keep_going)
File "/home/docs/checkouts/readthedocs.org/user_builds/demo-sphinx-extensions-for-dirac/envs/latest/lib/python3.7/site-packages/sphinx/application.py", line 228, in __init__
self.setup_extension(extension)
File "/home/docs/checkouts/readthedocs.org/user_builds/demo-sphinx-extensions-for-dirac/envs/latest/lib/python3.7/site-packages/sphinx/application.py", line 449, in setup_extension
self.registry.load_extension(self, extname)
File "/home/docs/checkouts/readthedocs.org/user_builds/demo-sphinx-extensions-for-dirac/envs/latest/lib/python3.7/site-packages/sphinx/registry.py", line 475, in load_extension
raise ExtensionError(__('Could not import extension %s') % extname, err)
sphinx.errors.ExtensionError: Could not import extension todo (exception: cannot import name 'SphinxDirective' from 'docutils.parsers.rst' (/home/docs/checkouts/readthedocs.org/user_builds/demo-sphinx-extensions-for-dirac/envs/latest/lib/python3.7/site-packages/docutils/parsers/rst/__init__.py))
Extension error:
Could not import extension todo (exception: cannot import name 'SphinxDirective' from 'docutils.parsers.rst' (/home/docs/checkouts/readthedocs.org/user_builds/demo-sphinx-extensions-for-dirac/envs/latest/lib/python3.7/site-packages/docutils/parsers/rst/__init__.py))
Well,
one has to use proper files from the tutorial, https://www.sphinx-doc.org/en/master/development/tutorials/todo.html , together with all installed packages.
This is ensured on the ReadTheDocs portal, where the extension buildup works well.
PS: Files and links are https://github.com/miroi/demo-sphinx-extensions-for-DIRAC
Related
Whenever I try to open any apps on anaconda navigator (such as Spyder), I get this message. I am almost sure that is a problem with the path but I cannot resolve it.
Traceback (most recent call last):
File "C:\Users\Windows\anaconda3\lib\site-packages\spyder\app\utils.py", line 281, in create_window
main.setup()
File "C:\Users\Windows\anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 772, in setup
from spyder.plugins.help.utils.sphinxify import CSS_PATH, DARK_CSS_PATH
File "C:\Users\Windows\anaconda3\lib\site-packages\spyder\plugins\help\utils\sphinxify.py", line 34, in
from jinja2 import Environment, FileSystemLoader
File "C:\Users\Windows\anaconda3\lib\site-packages\jinja2\__init__.py", line 12, in
from .environment import Environment
File "C:\Users\Windows\anaconda3\lib\site-packages\jinja2\environment.py", line 25, in
from .defaults import BLOCK_END_STRING
File "C:\Users\Windows\anaconda3\lib\site-packages\jinja2\defaults.py", line 3, in
from .filters import FILTERS as DEFAULT_FILTERS # noqa: F401
File "C:\Users\Windows\anaconda3\lib\site-packages\jinja2\filters.py", line 13, in
from markupsafe import soft_unicode
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (C:\Users\Windows\anaconda3\lib\site-packages\markupsafe\__init__.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Windows\anaconda3\Scripts\spyder-script.py", line 10, in
sys.exit(main())
File "C:\Users\Windows\anaconda3\lib\site-packages\spyder\app\start.py", line 237, in main
mainwindow.main(options, args)
File "C:\Users\Windows\anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 1992, in main
mainwindow = create_window(MainWindow, app, splash, options, args)
File "C:\Users\Windows\anaconda3\lib\site-packages\spyder\app\utils.py", line 283, in create_window
if main.console is not None:
File "C:\Users\Windows\anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 1088, in __getattr__
return self.get_plugin(self._INTERNAL_PLUGINS_MAPPING[attr])
File "C:\Users\Windows\anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 165, in get_plugin
raise SpyderAPIError(f'Plugin "{plugin_name}" not found!')
spyder.api.exceptions.SpyderAPIError: Plugin "internal_console" not found!
This code was running well in Ubuntu using conda. Then I had to move to a windows environment where I tried to create a similar conda environment. When I try running it, the error message is
Traceback (most recent call last):
File "C:\Users\biplavc\Documents\AoI_work\envs\dist_AoI_ver5\main_tf.py", line 30, in <module>
from create_graph_1 import *
File "C:\Users\biplavc\Documents\AoI_work\envs\dist_AoI_ver5\create_graph_1.py", line 16, in <module>
from tf_environment import *
File "C:\Users\biplavc\Documents\AoI_work\envs\dist_AoI_ver5\tf_environment.py", line 38, in <module>
from tf_agents.environments import py_environment
File "D:\Anaconda\envs\tf\lib\site-packages\tf_agents\environments\__init__.py", line 26, in <module>
from tf_agents.environments import utils
File "D:\Anaconda\envs\tf\lib\site-packages\tf_agents\environments\utils.py", line 28, in <module>
from tf_agents.policies import random_py_policy
File "D:\Anaconda\envs\tf\lib\site-packages\tf_agents\policies\__init__.py", line 20, in <module>
from tf_agents.policies import epsilon_greedy_policy
File "D:\Anaconda\envs\tf\lib\site-packages\tf_agents\policies\epsilon_greedy_policy.py", line 33, in <module>
from tf_agents.policies import greedy_policy
File "D:\Anaconda\envs\tf\lib\site-packages\tf_agents\policies\greedy_policy.py", line 42, in <module>
#gin.configurable(module='tf_agents', blacklist=['policy'])
TypeError: configurable() got an unexpected keyword argument 'blacklist'
I also couldn't come across any other errors similar to this and any help to sort this will be greatly appreciated.
I am facing some import error....But cv2 was succesfully installed in my mac....Pls provide some solution
This is my code
import cv2
img=cv2.imread("galaxy.jpg",1)
print(img)
This is output
akshitdudeja#Akshits-MacBook-Air Sec-17 % python3 script.py
Traceback (most recent call last):
File "/Users/akshitdudeja/VS Code/main_folder/UDEMY/Sec-17/script.py", line 1, in <module>
import cv2
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/cv2/__init__.py", line 180, in <module>
bootstrap()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/cv2/__init__.py", line 152, in bootstrap
native_module = importlib.import_module("cv2")
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/cv2/cv2.cpython-310-darwin.so, 0x0002): tried:
'/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/cv2/cv2.cpython-310-darwin.so' (mach-o file, but is an incompatibl
e architecture (have 'arm64', need 'x86_64')), '/usr/lib/cv2.cpython-310-darwin.so' (no such file)
I'm trying things out on windows vs linux where I have this working in 3.8 and 3.9.5, but not on windows using anaconda
import sys
sys.path.append("../")
from datetime import time
import pandas as pd
import pandas_market_calendars as mcal
error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\User\Anaconda3\envs\py39\lib\site-packages\pandas_market_calendars\__init__.py", line 19, in <module>
from .calendar_registry import get_calendar, get_calendar_names
File "C:\Users\User\Anaconda3\envs\py39\lib\site-packages\pandas_market_calendars\calendar_registry.py", line 21, in <module>
from .exchange_calendars_mirror import *
File "C:\Users\User\Anaconda3\envs\py39\lib\site-packages\pandas_market_calendars\exchange_calendars_mirror.py", line 9, in <module>
import exchange_calendars
File "C:\Users\User\Anaconda3\envs\py39\lib\site-packages\exchange_calendars\__init__.py", line 16, in <module>
from .calendar_utils import (
File "C:\Users\User\Anaconda3\envs\py39\lib\site-packages\exchange_calendars\calendar_utils.py", line 3, in <module>
from .always_open import AlwaysOpenCalendar
File "C:\Users\User\Anaconda3\envs\py39\lib\site-packages\exchange_calendars\always_open.py", line 5, in <module>
from .exchange_calendar import ExchangeCalendar
File "C:\Users\User\Anaconda3\envs\py39\lib\site-packages\exchange_calendars\exchange_calendar.py", line 27, in <module>
from .calendar_helpers import (
File "C:\Users\User\Anaconda3\envs\py39\lib\site-packages\exchange_calendars\calendar_helpers.py", line 6, in <module>
NP_NAT = np.array([pd.NaT], dtype=np.int64)[0]
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NaTType
'
Posted a github bug
indeed something changed and the culprit is pandas
https://github.com/rsheftel/pandas_market_calendars/issues/137
to solve, install pandas==1.2.5 and it will work
The error is with the underlying exchange_calendars package (https://github.com/gerrymanoim/exchange_calendars). It appears that error has been fixed in that package. If you update the exchange_calendars package everything will work fine. Nothing to do in this package.
Fix: gerrymanoim/exchange_calendars#41
I installed caffe from source code on my Mac os x, but when I type this command:
python -c "import caffe"
I got this error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/junhao.wen/Hao/Docker/Caffe/Caffe_source/caffe/python/caffe/__init__.py", line 1, in <module>
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
File "/Users/junhao.wen/Hao/Docker/Caffe/Caffe_source/caffe/python/caffe/pycaffe.py", line 15, in <module>
import caffe.io
File "/Users/junhao.wen/Hao/Docker/Caffe/Caffe_source/caffe/python/caffe/io.py", line 8, in <module>
from caffe.proto import caffe_pb2
File "/Users/junhao.wen/Hao/Docker/Caffe/Caffe_source/caffe/python/caffe/proto/caffe_pb2.py", line 7, in <module>
from google.protobuf import descriptor as _descriptor
File "/Users/junhao.wen/anaconda2/lib/python2.7/site-packages/protobuf-3.1.0-py2.7-macosx-10.6-x86_64.egg/google/protobuf/descriptor.py", line 46, in <module>
from google.protobuf.pyext import _message
ImportError: dlopen(/Users/junhao.wen/anaconda2/lib/python2.7/site-packages/protobuf-3.1.0-py2.7-macosx-10.6-x86_64.egg/google/protobuf/pyext/_message.so, 2): Symbol not found: __ZNK6google8protobuf10TextFormat17FieldValuePrinter10PrintBytesERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Referenced from: /Users/junhao.wen/anaconda2/lib/python2.7/site-packages/protobuf-3.1.0-py2.7-macosx-10.6-x86_64.egg/google/protobuf/pyext/_message.so
Expected in: flat namespace
in /Users/junhao.wen/anaconda2/lib/python2.7/site-packages/protobuf-3.1.0-py2.7-macosx-10.6-x86_64.egg/google/protobuf/pyext/_message.so
Any suggestion will be appreciated:)
Thanks in advance
Make sure that the Python path is pointing to $CAFFE_HOME/Python