I am trying to work with this G2P package. But I am getting dataclass_transform() got an unexpected keyword argument 'field_specifiers' this error. I am trying to run their sample code that they have provided there after running !pip install g2p_en in my jupyter notebook. The sample code for which I am getting the error is attached below. Can someone please help me with the issue?
from g2p_en import G2p
texts = ["I have $250 in my pocket.", # number -> spell-out
"popular pets, e.g. cats and dogs", # e.g. -> for example
"I refuse to collect the refuse around here.", # homograph
"I'm an activationist."] # newly coined word
g2p = G2p()
for text in texts:
out = g2p(text)
print(out)
Install the package from the anaconda base location (assuming you are using anaconda for jupyter notebook) with this command
conda install -c conda-forge g2p-en
Then simply import from g2p_en import G2p and run the example code. For me it did the job. There are various dependencies on anaconda base level which are not fully satisfied when you install the package from the jupyter lab only. You need to install from anaconda base location sometimes to make it work.
Related
I would like to install the gluonts package. The problem here is that there are extremely many compatibility issues. I cannot manually solve each of these compatibility problems by trial and error. Is there a general way to solve the whole thing automatically?
I am working in the PyCharm environment with Pyton. to use a virtual environment I am using Anaconda.
The packages I need in any case are Jupyter, Numpy, Pandas, mxnet, matplotlib and just glounts.
I have also tried to install the whole thing in a different order, that didn't work either, so I installed gluonts first, which also worked, but when I then wanted to install mxnet is then the problem.
Since I'm writing my bachelor thesis and accordingly under time pressure, I would be very grateful for your help.
My plan is to implement the whole thing in Pyton 3.6, I've also tried switching to Pyton 3.7, but that didn't help either. Now I will try it with Python 3.5.
When solving the problem, it should be noted that I am not completely free in my way of working, since I work on a unicomputer and do not have all the rights, etc.
EDIT
So I have now found a solution myself, how to use everything reasonably.
You create with anaconda prompt a new environment and use there Python 3.9 , when creating give the following code
conda create -n env python=3.9 numpy=1.16.6
conda activate env
pip install mxnet gluonts jupyter
conda deactivate
now you could select this as normal environment in PyCharm. You could also look at the whole thing normally in the anaconda navigator and see which packages you have on it.
The general form is:
pip install gluonts
You should try this:
# support for mxnet models, faster datasets
pip install gluonts[mxnet,pro]
# support for torch models, faster datasets
pip install gluonts[torch,pro]
and then try this example:
from gluonts.dataset.util import to_pandas
from gluonts.dataset.pandas import PandasDataset
from gluonts.dataset.repository.datasets import get_dataset
from gluonts.model.deepar import DeepAREstimator
from gluonts.mx import Trainer
dataset = get_dataset("airpassengers")
deepar = DeepAREstimator(prediction_length=12, freq="M", trainer=Trainer(epochs=5))
model = deepar.train(dataset.train)
# Make predictions
true_values = to_pandas(list(dataset.test)[0])
true_values.to_timestamp().plot(color="k")
prediction_input = PandasDataset([true_values[:-36], true_values[:-24], true_values[:-12]])
predictions = model.predict(prediction_input)
for color, prediction in zip(["green", "blue", "purple"], predictions):
prediction.plot(color=f"tab:{color}")
plt.legend(["True values"], loc="upper left", fontsize="xx-large")
Here is the link to the gluonts 0.10.2 module:
https://pypi.org/project/gluonts/
Please state any errors that you see with this.
I've been running into this issue, my Jupyter Lab seems to be running 'Python ipykernel' instead of just saying running 'python 3'. Essentially, both of them are python 3 however, I've found a few issues with using ipykernel, I don't know why (Such as simple pandas groupby functions). I didn't feel the need to share any screenshots for this one, hope somebody can help me out; if need be, I can still post it.
I want to make it to Python 3 and not ipykernel
-------- EDIT--------------
Okay, so many of you are saying that it's not that. I've decided to provide screenshots to show that the outputs of my groupby function are completely different.
EXHIBIT A: Using labs when it just says Python3
EXHIBIT B: Using labs when it just says Python 3 ipykernel
SAME code, SAME dataset, different output ? Why ?
ipykernel is using Python 3. Jupyter (whether notebook, lab, or any other interface) is and always was using ipykernel as the default kernel for Python. You might be confused because the latest version added the (ipykernel) label (in this PR) to inform users which kernel they are using. There are other kernels like xeus-python.
It is highly, like really highly, unlikely that ipykernel is the source of your problems. You can try downgrading it to previous version if you believe it worked better for you:
pip install "ipykernel<6"
but actually I would first recommend doing the opposite, this is ensuring that you are running the latest ipykernel patch release with:
pip install -U ipykernel
Once you confirm that ipykernel is not a source of your problem, I would recommend asking a more detailed question with a reproducible example of the pandas code that you have problem with.
I am using Spyder 4.1.5 with Python 3.8.5 with Anaconda
When trying to show the content of a variable in Spyder i get the following error
Spyder is unable to show the variable you are trying to view because the module spydercustomize was not found in your Spyder environment. Please install this package in your Spyder environment.
A simple pip install spydercustomize does not work
I don't even know why it is missing. I think the problem occured the first time when I tried to update Spyder. A reinstallation of Anaconda didn't help either.
My Google skills were not good enough to find any solution. I only find problems where variables don't show in the variable explorer. But that is not my problem.
Btw, built in classes like lists or dicts can be displayed, custom classes can't.
I appreciate your help!
EDIT
After updating to Spyder 4.2.0 I got the following error:
Spyder was unable to retrieve the value of this variable from the
console.
The error message was: An error occured, see the console.
Note: Please don't report this problem on Github, there's nothing to
do about it.
Console is empty
Looks like spydercustomize is part of a package called spyder-kernels. Maybe try:
$ pip install spyder spyder-kernels --upgrade
I am using python 3.6 Following is my simple code:
import folium
city_location = [-23.6573395, -46.5322504]
m = folium.Map(location=city_location, zoom_start=15, tiles='openstreetmap')
folium.Marker(city_location, popup='<i>Teste</i>', tooltip='Click me!').add_to(m)
m
But I keep getting the error saying:
TypeError: __init__() got an unexpected keyword argument 'tooltip'
What can I do to show a tooltip upon my marker ?
The tooltip was added with the version v.0.0.6.
Refer to this issue : https://github.com/python-visualization/folium/pull/724
From your comment, it was six month after you installed it.
So, update your dependencies and it should work
You can check your version by doing pip freeze > requirements.txt
Check the folium version there. If it is under 0.0.6, then perform a :
pip install folium --upgrade and you are done
Also, check the Release page, this library is in active development, so you should always update if you want to enjoy and test the last features !
I'm having a 'module not found' issue, and my problem research has pointed me toward possible filepath name issues. I need some help verifying that my filepaths are correctly aligned.
When I first set up Jupyter Notebook and Python on my computer, and I didn't understand virtualenv at all, I made a lot of errors which were later discovered when coming across the 'module not found' issue.
I thought I had gotten this sorted at a few months back, as I haven't had any problems since and have used pip multiple times since for loading new libraries.
THE ERROR:
import tweepy
ModuleNotFoundError: No module named 'tweepy'
CHECKING IN PYTHON NOTEBOOK:
import sys
print(sys.executable)
/Users/Moos/anaconda3/envs/python3/bin/python
print(sys.path)
['',
'/Users/Moos/anaconda3/envs/python3/lib/python36.zip',
'/Users/Moos/anaconda3/envs/python3/lib/python3.6',
'/Users/Moos/anaconda3/envs/python3/lib/python3.6/lib-dynload',
'/Users/Moos/anaconda3/envs/python3/lib/python3.6/site-packages',
'/Users/Moos/anaconda3/envs/python3/lib/python3.6/site-
packages/aeosa',
'/Users/Moos/anaconda3/envs/python3/lib/python3.6/site-
packages/IPython/extensions','/Users/Moos/.ipython'
]
IN TERMINAL:
which pip
/Users/Moos/anaconda3/bin/pip
which pip3
/Users/Moos/anaconda3/bin/pip3
jupyter kernelspec list
Available kernels:
python2 /usr/local/share/jupyter/kernels/python2
python3 /usr/local/share/jupyter/kernels/python3
Is there an issue with the kernelspec list? Should they be referencing the anaconda3 pathway?
Repeat: I do not have this problem with any other library.
Maybe a trivial suggestion but have you checked if the "tweepy" is actually available in your current environment?
To check this you can type the following in anaconda prompt: "conda list tweepy", otherwise you might use the anaconda navigator to perform the same check visually.