I am using python3.4.1 in win7
And I wana use matplotlib.
but this error code has occured.
Could you help me?
>>> text4.dispersion_plot(["citizens", "democracy", "freedom", "duties", "America"])
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\nltk\draw\dispersion.py", line 25, in dispersion_plot
import pylab
File "C:\Python34\lib\site-packages\pylab.py", line 1, in <module>
from matplotlib.pylab import *
File "C:\Python34\lib\site-packages\matplotlib\__init__.py", line 105, in <module>
import six
ImportError: No module named 'six'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
text4.dispersion_plot(["citizens", "democracy", "freedom", "duties", "America"])
File "C:\Python34\lib\site-packages\nltk\text.py", line 445, in dispersion_plot
dispersion_plot(self, words)
File "C:\Python34\lib\site-packages\nltk\draw\dispersion.py", line 27, in dispersion_plot
raise ValueError('The plot function requires the matplotlib package (aka pylab).'
ValueError: The plot function requires the matplotlib package (aka pylab).See
http://matplotlib.sourceforge.net/
>>>
Related
I am trying to run this text-to-speech program
I followed instructions verbatim, but when I go to run the first line of code (below)
python tortoise/do_tts.py --text "I'm going to speak this" --voice random --preset fast
I get he following error code:
C:\Users\chase\anaconda3\lib\site-packages\torchaudio\_internal\module_utils.py:99: UserWarning: Failed to import soundfile. 'soundfile' backend is not available.
warnings.warn("Failed to import soundfile. 'soundfile' backend is not available.")
C:\Users\chase\anaconda3\lib\site-packages\paramiko\transport.py:219: CryptographyDeprecationWarning: Blowfish has been deprecated
"class": algorithms.Blowfish,
Traceback (most recent call last):
File "C:\Users\chase\anaconda3\lib\site-packages\soundfile.py", line 152, in <module>
_snd = _ffi.dlopen(_libname)
OSError: cannot load library 'C:\Users\chase\anaconda3\Library\bin\sndfile.dll': error 0x7e
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\chase\anaconda3\lib\site-packages\soundfile.py", line 178, in <module>
_snd = _ffi.dlopen(_os.path.join(_path, '_soundfile_data', _packaged_libname))
OSError: cannot load library 'C:\Users\chase\anaconda3\lib\site-packages\_soundfile_data\libsndfile_64bit.dll': error 0x7e
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\chase\tortoise-tts\tortoise\do_tts.py", line 7, in <module>
from api import TextToSpeech, MODELS_DIR
File "C:\Users\chase\tortoise-tts\tortoise\api.py", line 22, in <module>
from tortoise.utils.audio import wav_to_univnet_mel, denormalize_tacotron_mel
File "C:\Users\chase\anaconda3\lib\site-packages\tortoise-2.4.2-py3.9.egg\tortoise\utils\audio.py", line 4, in <module>
import librosa
File "C:\Users\chase\anaconda3\lib\site-packages\librosa-0.9.2-py3.9.egg\librosa\__init__.py", line 209, in <module>
from . import core
File "C:\Users\chase\anaconda3\lib\site-packages\librosa-0.9.2-py3.9.egg\librosa\core\__init__.py", line 6, in <module>
from .audio import * # pylint: disable=wildcard-import
File "C:\Users\chase\anaconda3\lib\site-packages\librosa-0.9.2-py3.9.egg\librosa\core\audio.py", line 8, in <module>
import soundfile as sf
File "C:\Users\chase\anaconda3\lib\site-packages\soundfile.py", line 189, in <module>
_snd = _ffi.dlopen(_libname)
OSError: cannot load library 'libsndfile.dll': error 0x7e
I expected it to run
Try on linux, it works fine for me.
i bought a rapberry pi 4 to code, i know is not the best platform, but recently my computer got stolen and its all i can afford right know.
im trying to get vpython to run.
these is the code that im trying to run
import vpython
ball=vpython.sphere()
while True:
pass
but it gives me these error.
Traceback (most recent call last):
File "/home/maviles/Documents/py-course/Vputhon/vppython.py", line 2, in <module>
ball=vpython.sphere()
File "/home/maviles/.local/lib/python3.9/site-packages/vpython/vpython.py", line 1172, in __init__
super(sphere, self).setup(args)
File "/home/maviles/.local/lib/python3.9/site-packages/vpython/vpython.py", line 599, in setup
super(standardAttributes, self).__init__()
File "/home/maviles/.local/lib/python3.9/site-packages/vpython/vpython.py", line 259, in __init__
from .no_notebook import _
File "/home/maviles/.local/lib/python3.9/site-packages/vpython/no_notebook.py", line 12, in <module>
from autobahn.asyncio.websocket import WebSocketServerProtocol, WebSocketServerFactory
File "/home/maviles/.local/lib/python3.9/site-packages/autobahn/asyncio/__init__.py", line 32, in <module>
from autobahn.asyncio.websocket import \
File "/home/maviles/.local/lib/python3.9/site-packages/autobahn/asyncio/websocket.py", line 36, in <module>
from autobahn.util import public, hltype
File "/home/maviles/.local/lib/python3.9/site-packages/autobahn/util.py", line 49, in <module>
from OpenSSL import SSL
File "/usr/lib/python3/dist-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import crypto, SSL
File "/usr/lib/python3/dist-packages/OpenSSL/crypto.py", line 1556, in <module>
class X509StoreFlags(object):
File "/usr/lib/python3/dist-packages/OpenSSL/crypto.py", line 1577, in X509StoreFlags
CB_ISSUER_CHECK = _lib.X509_V_FLAG_CB_ISSUER_CHECK
AttributeError: module 'lib' has no attribute 'X509_V_FLAG_CB_ISSUER_CHECK'
exit
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/home/maviles/.local/lib/python3.9/site-packages/vpython/vpython.py", line 22, in Exit
a = 1.0/zero
ZeroDivisionError: float division by zero
Exception ignored in: <function standardAttributes.__del__ at 0x7f93664550>
Traceback (most recent call last):
File "/home/maviles/.local/lib/python3.9/site-packages/vpython/vpython.py", line 1159, in __del__
super(standardAttributes, self).__del__()
File "/home/maviles/.local/lib/python3.9/site-packages/vpython/vpython.py", line 340, in __del__
cmd = {"cmd": "delete", "idx": self.idx}
AttributeError: 'sphere' object has no attribute 'idx'
please help.
i could not find anything on these topic for the raspberry 4b
i try to run the code and expec it to open a window with a sphere
Try 'flask run --help' for help.
Error: While importing "main", an ImportError was raised:
Traceback (most recent call last):
File "/home/anirudh/Downloads/blinktrustapis-main/main.py", line 9, in
from .apis.appServer import AppServer
ImportError: attempted relative import with no known parent package
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/flask/cli.py", line 240, in locate_app
import(module_name)
File "/home/anirudh/Downloads/blinktrustapis-main/main.py", line 11, in
from apis.appServer import AppServer
File "/home/anirudh/Downloads/blinktrustapis-main/apis/appServer.py", line 32, in
from apis.utility import *
File "/home/anirudh/Downloads/blinktrustapis-main/apis/utility.py", line 6, in
from dataprofiler.piiservice.api import ScanTypeEnum, list_detectors, scan_database
File "/home/anirudh/Downloads/blinktrustapis-main/dataprofiler/piiservice/api.py", line 6, in
from dataprofiler.catelogs.api import scan_sources
File "/home/anirudh/Downloads/blinktrustapis-main/dataprofiler/catelogs/api.py", line 13, in
from dataprofiler.catelogs.catalog.db import DbScanner
File "/home/anirudh/Downloads/blinktrustapis-main/dataprofiler/catelogs/catalog/db.py", line 6, in
from databuilder import Scoped
ImportError: cannot import name 'Scoped' from 'databuilder' (/home/anirudh/.local/lib/python3.9/site-packages/databuilder/init.py)
I was trying to get this ConvexHull function running, and I needed numpy (I think) to get it to work. I'm going to try to get numpy uninstalled and reinstalled, but I'm not sure why/how this happened so that I can prevent it from happening again.
While I was running through some of the examples, I decided to stop running from the prompt to save some typing. When I ran the seemingly same bits of code from a file, it returned the following error message:
>>>
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 2218, in _find_and_load_unlocked
AttributeError: 'module' object has no attribute '__path__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Python34/numpy.py", line 1, in <module>
from scipy.spatial import ConvexHull
File "C:\Python34\lib\site-packages\scipy\__init__.py", line 61, in <module>
from numpy import show_config as show_numpy_config
File "C:/Python34\numpy.py", line 1, in <module>
from scipy.spatial import ConvexHull
File "C:\Python34\lib\site-packages\scipy\spatial\__init__.py", line 90, in <module>
from .kdtree import *
File "C:\Python34\lib\site-packages\scipy\spatial\kdtree.py", line 8, in <module>
import scipy.sparse
File "C:\Python34\lib\site-packages\scipy\sparse\__init__.py", line 212, in <module>
from .base import *
File "C:\Python34\lib\site-packages\scipy\sparse\base.py", line 11, in <module>
from scipy._lib.six import xrange
File "C:\Python34\lib\site-packages\scipy\_lib\__init__.py", line 14, in <module>
from numpy.testing import Tester
ImportError: No module named 'numpy.testing'; 'numpy' is not a package
>>> ================================ RESTART ================================
Now, when I type import numpy from the prompt, it returns:
>>> import numpy
Traceback (most recent call last):
File "<pyshell#40>", line 1, in <module>
import numpy
File "C:/Python34\numpy.py", line 1, in <module>
from scipy.spatial import ConvexHull
File "C:\Python34\lib\site-packages\scipy\__init__.py", line 61, in <module>
from numpy import show_config as show_numpy_config
ImportError: cannot import name 'show_config'
The entire setup was running without issue a few minutes ago, and I am unsure exactly why this all stopped.
The full text of my commands is here. The file was short, C:\Python34\numpy.py with the following contents:
from scipy.spatial import ConvexHull
import numpy as np
points = np.random.rand(30,2)
Change the file name to something different than numpy.py.
I have this code:
import random
import matplotlib.pyplot as plotttt
def simular (N):
Nd=N
c=0
while Nd>(N/2-1):
r=random.uniform(0,1)
if r<Nd/float(N):
Nd=Nd-1
else:
Nd=Nd+1
c+=1
return c
def main ():
Nmax=400
repeticiones=100
x=[]
y=[]
for j in range (2,Nmax):
promedio=0
for i in range (0,repeticiones):
promedio+=simular(j)
y.append(promedio/repeticiones)
x.append(j)
plotttt.plot (x,y,"bo")
plotttt.show()
main()
But when I try to run in through terminal the next error appears:
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 1519, in _find_and_load_unlocked
AttributeError: 'module' object has no attribute '__path__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/matplotlib/__init__.py", line 124, in <module>
import pyparsing
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pyparsing.py", line 65, in <module>
import string.ascii_lowercase
ImportError: No module named 'string.ascii_lowercase'; string is not a package
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "simulacion.py", line 2, in <module>
import matplotlib.pyplot as plotttt
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/matplotlib/__init__.py", line 126, in <module>
raise ImportError("matplotlib requires pyparsing")
ImportError: matplotlib requires pyparsing
Vicente-Gomezs-MacBook-Pro:Python Vicente$
However no problem occurs when I run it on IDLE. Ideas?