Closed eadsa1998 closed 3 years ago
Hi ! When you import datasets
, python looks at your installed packages, but also at the modules defined in the directory from which you run your code. It is the case because the current working directory is added to your python path when you run your code.
In your case I think it tries to load your datasets.py
in the equity-analysts-sentiment
folder, since the name is conflicting. If you rename this file you should be good.
Ok so I renamed the file and it still wouldn't run. I also tried moving it around to run it in other directories and see if I had better luck but I still got this same error everywhere I tried it.
If you're still having this error:
ImportError: cannot import name 'load_dataset' from 'datasets' (C:\Users\bookw\Dropbox\Equity-Analyst-Project\equity-analysts-sentiment\datasets.py)
Then it probably means that C:\Users\bookw\Dropbox\Equity-Analyst-Project\equity-analysts-sentiment
is still in your python path. Can you check that you didn't add this path to your python path via environment variables or via your IDE ? I know that some of them like PyCharm add project directories to the python path automatically for example.
I don't think I'm using a virtual enviroment or IDE, just Jupyter Notebooks. I'll paste my python path below but I don't see that in there.
C:\Users\bookw\anaconda3;C:\Users\bookw\anaconda3\Library\mingw-w64\bin;C:\Users\bookw\anaconda3\Library\usr\bin;C:\Users\book w\anaconda3\Library\bin;C:\Users\bookw\anaconda3\Scripts;C:\Users\bookw\anaconda3\bin;C:\Users\bookw\anaconda3\condabin;C:\Use rs\bookw\anaconda3;C:\Users\bookw\anaconda3\Library\mingw-w64\bin;C:\Users\bookw\anaconda3\Library\usr\bin;C:\Users\bookw\anac onda3\Library\bin;C:\Users\bookw\anaconda3\Scripts;C:\Program Files\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\W indows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files (x86)\ NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Git\cmd;C:\Program Files\P uTTY;C:\Program Files\dotnet;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C: \WINDOWS\System32\OpenSSH;C:\Users\bookw\AppData\Local\Microsoft\WindowsApps;C:\Users\bookw\AppData\Local\Programs\MiKTeX\mikt ex\bin\x64;C:\Users\bookw.dotnet\tools;.
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.
I am facing the same issue when trying to follow the datasets tutorial from the Huggingface course. The line
from datasets import load_dataset
causes the following error:
ImportError: cannot import name 'load_dataset' from 'datasets' (unknown location)
.
My environment:
conda install -c huggingface -c conda-forge datasets
)The Colab notebook provided by the course works fine. This error occurs only locally. Could this be an M1 related issue on the Macbook? I have had problems in the past with conda installations and also with tensorflow on the M1.
@eadsa1998 Did you manage to resolve the problem?
the same issue also
I had the same issue and solved it by reinstalling the datasets package.
the same issue also now
I'm having the same issue, and it still don't work after reinstalling the datasets package.
Can you check that you don't have a directory named "datasets" or a file "datasets.py" in your working directory or in directories in your python path (including the ones that your IDE may be adding) ?
The ImportError can also show the location of the diretory/file that is imported instead of the datasets
package
Thank you @lhoestq I had the datasets
folder. 😅
try pip install datasets
When I tried to run the from dataset import load_dataset but it is showing ImportError: cannot import name 'load_dataset' from 'dataset' (/usr/local/lib/python3.10/dist-packages/dataset/init.py) This error and tried everything but still not working. @eadsa1998 did you resolve this issue.
hi @whoisusmanali did you resolve the issue? i also have the same issue like yours (path)
run
pip install datasets==2.21.0
@ditarnnt @whoisusmanali
Environment info
transformers
version: 4.6.0Who can help
@LysandreJik and @lhoestq helped on the other issues that I looked at so they might be able to help here. But I'll take anyone really.
Information
I am attempting to run finBERT and am having trouble with the datasets package. I looked at a couple of other issues from people who had similar problems but none of their solutions worked for me. I'm sorry if I didn't provide some information or missed something obvious, I'm new to programming and very new to machine learning so I don't quite know what/where everything is yet!
The problem arises when using:
The tasks I am working on is:
To reproduce
Steps to reproduce the behavior:
""""" ImportError Traceback (most recent call last)