I recently did
pip install --user sphinx-toolbox
Since then i get the following error message each time i run a python script:
Error processing line 1 of /home/jody/.local/lib/python3.9/site-packages/_sphinx_jinja2_compat.pth:
Traceback (most recent call last):
File "/usr/lib/python-exec/python3.9/../../../lib/python3.9/site.py", line 169, in addpackage
exec(line)
File "<string>", line 1, in <module>
File "/home/jody/.local/lib/python3.9/site-packages/sphinx_jinja2_compat/__init__.py", line 44, in <module>
import markupsafe # noqa: E402
ModuleNotFoundError: No module named 'markupsafe'
Remainder of file ignored
After this my scripts works normally.
How can i fix this issue?
Related
I have tried upgrading Python version on a Miniconda installation by running conda update python. The version was being taken from 3.8 to 3.10. This seems to have broken the installation. No matter what command I run, I get the following:
➜ project conda activate
Traceback (most recent call last):
File "/home/user/miniconda3/lib/python3.10/site-packages/conda/common/serialize.py", line 13, in <module>
import ruamel_yaml as yaml
ModuleNotFoundError: No module named 'ruamel_yaml'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/user/miniconda3/lib/python3.10/site-packages/conda/common/serialize.py", line 16, in <module>
import ruamel.yaml as yaml
ModuleNotFoundError: No module named 'ruamel'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/user/miniconda3/bin/conda", line 15, in <module>
sys.exit(main())
File "/home/user/miniconda3/lib/python3.10/site-packages/conda/cli/main.py", line 118, in main
from ..exceptions import conda_exception_handler
File "/home/user/miniconda3/lib/python3.10/site-packages/conda/exceptions.py", line 24, in <module>
from .models.channel import Channel
File "/home/user/miniconda3/lib/python3.10/site-packages/conda/models/channel.py", line 17, in <module>
from ..base.context import context, Context
File "/home/user/miniconda3/lib/python3.10/site-packages/conda/base/context.py", line 55, in <module>
from ..common.configuration import (Configuration, ConfigurationLoadError, MapParameter,
File "/home/user/miniconda3/lib/python3.10/site-packages/conda/common/configuration.py", line 42, in <module>
from .serialize import yaml_round_trip_load
File "/home/user/miniconda3/lib/python3.10/site-packages/conda/common/serialize.py", line 18, in <module>
raise ImportError("No yaml library available. To proceed, conda install ruamel_yaml")
ImportError: No yaml library available. To proceed, conda install ruamel_yaml
Help on fixing this is appreciated.
My OS is Windows7 32bit & I use VScode and python 3.6 32bit
When I tried
C:\python>pip install client
Collecting httpclient
Using cached httpclient-0.0.2.zip
Complete output from command python setup.py egg_info:
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.19.tar.gz
Extracting in C:\Users\Public\Documents\ESTsoft\CreatorTemp\tmptrynwiem
Traceback (most recent call last):
File "C:\Users\Public\Documents\ESTsoft\CreatorTemp\pip-build-b7pgq1re\httpclient\distribute_setup.py", line 143, in use_setuptools
raise ImportError
ImportError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Public\Documents\ESTsoft\CreatorTemp\pip-build-b7pgq1re\httpclient\setup.py", line 13, in <module>
use_setuptools()
File "C:\Users\Public\Documents\ESTsoft\CreatorTemp\pip-build-b7pgq1re\httpclient\distribute_setup.py", line 145, in use_setuptools
return _do_download(version, download_base, to_dir, download_delay)
File "C:\Users\Public\Documents\ESTsoft\CreatorTemp\pip-build-b7pgq1re\httpclient\distribute_setup.py", line 125, in _do_download_build_egg(egg, tarball, to_dir)
File "C:\Users\Public\Documents\ESTsoft\CreatorTemp\pip-build-b7pgq1re\httpclient\distribute_setup.py", line 99, in _build_egg_extractall(tar)
File "C:\Users\Public\Documents\ESTsoft\CreatorTemp\pip-build-b7pgq1re\httpclient\distribute_setup.py", line 467, in _extractallself.chown(tarinfo, dirpath)
TypeError: chown() missing 1 required positional argument: 'numeric_owner'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Public\Documents\ESTsoft\CreatorTemp\pip-build-b7pgq1re\httpclient\
The httplib module has been renamed to http.client in Python 3. You don't need to install http.client in python 3. It is pre-installed. So directly import it in your script as follows:
import http.client
I have installed python 3.6.0, you don't need to install pip manually if you are using python (>3.3). But When I am trying to access pip (pip --version), it throws me two errors which mainly relate to not finding the module.
Description is given below.
C:\Users\sharma6>pip --version
Traceback (most recent call last):
File "c:\python360\lib\site-packages\pip\_vendor\requests\packages\__init__.py", line 27, in <module>
from . import urllib3
File "c:\python360\lib\site-packages\pip\_vendor\requests\packages\urllib3\__init__.py", line 8, in <module>
from .connectionpool import (
File "c:\python360\lib\site-packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 7, in <module>
from socket import error as SocketError, timeout as SocketTimeout
File "c:\python360\lib\socket.py", line 49, in <module>
import _socket
zipimport.ZipImportError: can't find module '_socket'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\python360\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\python360\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\python360\Scripts\pip.exe\__main__.py", line 5, in <module>
File "c:\python360\lib\site-packages\pip\__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
File "c:\python360\lib\site-packages\pip\_vendor\requests\__init__.py", line 62, in <module>
from .packages.urllib3.exceptions import DependencyWarning
File "c:\python360\lib\site-packages\pip\_vendor\requests\packages\__init__.py", line 29, in <module>
import urllib3
ModuleNotFoundError: No module named 'urllib3'
Even when I import socket (>>>import socket)in python interpreter , It shows me "Can not found the module" error .
>>> import socket
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\python352\lib\socket.py", line 49, in <module>
import _socket
zipimport.ZipImportError: can't find module '_socket
Could someone tell me about the errors and how to resolve them because I need pip to work properly.
Add your all path in your system variable instead of adding in user variable.
It worked for me!!! :)
You should try to write
python -m pip --version
If this gives an error message, install pip by downloading get-pip.py from https://pip.pypa.io/en/stable/installing/ and install with
python get-pip.py
Installing with pip is then done by
python -m pip install [package name]
I am trying to generate API documentation from comments (in numpydoc style) in my project and I am stuck at vague import errors from sphinx:
/home/carbolymer/workspace/si-app/doc/source/scripts.rst:10: WARNING: autodoc: failed to import module 'scripts.backtest'; the following exception was raised:
Traceback (most recent call last):
File "/usr/lib/python3.5/site-packages/sphinx/ext/autodoc.py", line 547, in import_object
__import__(self.modname)
File "/home/carbolymer/workspace/si-app/application/scripts/backtest.py", line 6, in <module>
from scipy import stats
File "/usr/lib/python3.5/site-packages/scipy/__init__.py", line 64, in <module>
from numpy import __version__ as __numpy_version__
ImportError: cannot import name '__version__'
/home/carbolymer/workspace/si-app/doc/source/scripts.rst:18: WARNING: autodoc: failed to import module 'scripts.importdb'; the following exception was raised:
Traceback (most recent call last):
File "/usr/lib/python3.5/site-packages/sphinx/ext/autodoc.py", line 547, in import_object
__import__(self.modname)
File "/home/carbolymer/workspace/si-app/application/scripts/importdb.py", line 5, in <module>
from si.storage.dataimport import DataImport, database_drivers, sources
File "/home/carbolymer/workspace/si-app/application/si/storage/dataimport.py", line 6, in <module>
from si.storage.datasource.file import Stooq as StooqFile
File "/home/carbolymer/workspace/si-app/application/si/storage/datasource/file.py", line 19, in <module>
from si.storage.datasource.util import correct_prices
File "/home/carbolymer/workspace/si-app/application/si/storage/datasource/util.py", line 4, in <module>
def correct_prices(dataframe, calendar=PolishCalendar()):
File "/usr/lib/python3.5/unittest/mock.py", line 917, in __call__
return _mock_self._mock_call(*args, **kwargs)
File "/usr/lib/python3.5/unittest/mock.py", line 976, in _mock_call
result = next(effect)
StopIteration
Full log:
http://pastebin.com/tycmVQdN
I've tried mocking numpy.__version__ but it does not work. Also I have no clue what about the lines containing PolishCalendar() - why sphinx is trying to mock this object?
Because of those import errors, these files are missing in the documentation. How can I fix this?
My build command:
make clean ; sphinx-apidoc -a -f -o ./source ../application ; make html
Versions:
$ sphinx-build --version
Sphinx (sphinx-build) 1.5.1
$ python --version
Python 3.5.2
source/conf.py: http://pastebin.com/VfsiX4uZ
I have python2.7 and python3.5 installed via Macports. I am trying to get neovim up and running and for this I ran
$ sudo pip2 install neovim
$ sudo pip-3.5 install neovim
Which installs the packages into different subdirs of /opt/local/Library/Frameworks/Python.framework/Versions/. Now when running Python 3.5, import neovim tries to load the 2.7 package (which fails), as I can see from the stack trace.
The full error is this:
$ python3.5 -c "import neovim"
Traceback (most recent call last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/neovim/msgpack_rpc/event_loop/__init__.py", line 7, in <module>
from .uv import UvEventLoop
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/neovim/msgpack_rpc/event_loop/uv.py", line 5, in <module>
import pyuv
ImportError: No module named 'pyuv'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/neovim/msgpack_rpc/event_loop/asyncio.py", line 19, in <module>
import asyncio
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/asyncio/__init__.py", line 21, in <module>
from .base_events import *
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/asyncio/base_events.py", line 18, in <module>
import concurrent.futures
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/concurrent/futures/__init__.py", line 8, in <module>
from concurrent.futures._base import (FIRST_COMPLETED,
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/concurrent/futures/_base.py", line 357
raise type(self._exception), self._exception, self._traceback
^
SyntaxError: invalid syntax
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/neovim/__init__.py", line 11, in <module>
from .msgpack_rpc import (ErrorResponse, child_session, socket_session,
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/neovim/msgpack_rpc/__init__.py", line 8, in <module>
from .event_loop import EventLoop
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/neovim/msgpack_rpc/event_loop/__init__.py", line 12, in <module>
from .asyncio import AsyncioEventLoop
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/neovim/msgpack_rpc/event_loop/asyncio.py", line 22, in <module>
import trollius as asyncio
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/trollius/__init__.py", line 21, in <module>
from .base_events import *
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/trollius/base_events.py", line 39, in <module>
from . import coroutines
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/trollius/coroutines.py", line 16, in <module>
from . import futures
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/trollius/futures.py", line 19, in <module>
from . import executor
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/trollius/executor.py", line 12, in <module>
import concurrent.futures
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/concurrent/futures/__init__.py", line 8, in <module>
from concurrent.futures._base import (FIRST_COMPLETED,
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/concurrent/futures/_base.py", line 357
raise type(self._exception), self._exception, self._traceback
^
SyntaxError: invalid syntax
What do I have to do in order for Python 2.7 and 3 to coexist peacefully on my system?
I recently had this problem as well, but it was not related to PYTHONPATH, which on my machine was unset. In my situation Python and pip were installed via MacPorts. Cleaning, self-updating MacPorts and then updating pip to the most recent version, and then running the following resolved the issue:
port select --set pip pip35