ModuleNotFoundError with pyDataverse - API for Harvard Dataverse - python

I'm trying to use a Python API to access and download data the Harvard Dataverse. The FAQs page for using APIs to access the Dataverse suggests the dataverse package, and the .readme for that GitHub repo points towards an alternative pyDataverse package. When I try to run and import these modules in a Jupyter Notebook I get a ModuleNotFoundError - but I have all the dependencies for these modules installed (requests, jsonschema, urllib3), so I'm not sure what the problem is.
!pip install pyDataverse
import pyDataverse
Returns:
ModuleNotFoundError: No module named 'pyDataverse'
And the same issue when I try the dataverse module - this module isn't available through PyPI so I ran pip install -e git+https://github.com/IQSS/dataverse-client-python.git#egg=dataverse instead (see the readme) and then ran import dataverse - which produced the same error. Any idea what I'm doing wrong? Or alternative suggestions for APIs to access Dataverse repositories?

Related

Can't use spotipy even though I installed it

I installed spotipy on my laptop using pip install spotify
at cmd. I checked that spotipy was successfully installed using pip install check.
pip install spotify error message
result of pip list
However, when I try to use spotify on kaggle, I get an error message that says there is no module named spotify.
I had similar issues with jupyter notebook. What should I do to fix this?
When you install a package using pip, you get to use it through Python. Spotipy isn't a CLI tool, and cannot be accessed by simply typing it on cmd. If you were to open up a Python terminal and try import spotipy, it would import properly.
Consider the block of code on the official Spotipy doc. It imports Spotipy, then uses it within the code itself:
import spotipy
...
spotify = spotipy.Spotify(client_credentials_manager=SpotifyClientCredentials())
results = spotify.artist_albums(birdy_uri, album_type='album')
Also consider reading up on Python packages and how they work.

How to solve GraphQl ImportError - cannot import name 'gql' from 'gql' in Python?

I installed GraphQl on Windows 10 Laptop using the below command:
pip install --pre gql[all]
I tried using the Basic example available on Official Github Page. in my Python IDLE.
However, I am getting this ImportError in my IDLE.
ImportError: cannot import name 'gql' from 'gql'
Kindly help in resolving the issue.
Thanks
make sure the name of your file you're testing with isn't named something similar to a package you're importing. Just got me when I named my file ariadne.py
https://github.com/mirumee/ariadne/issues/400#issue-662473441

I can't get coinmarketcap library working

First I installed the coinmarketcap from the pycharm project interpreter.
Then I run the code below:
>>> from coinmarketcap import Market
>>> coinmarketcap = Market()
>>> coinmarketcap.ticker(<currency>, limit=3, convert='EUR')
But I got this:
ImportError: cannot import name Market
Then I thought it is not the right library, so I installed the following API from https://github.com/mrsmn/coinmarketcap-api thinking that pycharm might have installed some other library.
So I downloaded the library from Github and I used the python setup.py install command and installed the library from Github without any problems.
I tried to rerun the code, but the problem still persists:
ImportError: cannot import name Market
I have finally solved it. Actually I needed to uninstall it within pycharm. Then I installed it using the pip install coinmarketcap and after that it works.
Thank you for your help!
I have installed it using pip and tried to import it and did not get any error.so, can you check whether the installation is done with out any error

ImportError: No module named oauth_dance

I am using PyDev and Eclipse to create a project that uses Twitter Search API to collect data. When I try to run it I get the error saying
from twitter.oauth_dance import parse_oauth_tokens
ImportError: No module named oauth_dance
I have already installed twitter using pip install twitter, there is a module called oauth_dance.py and oauth_dance.pyc in the twitter folder in C:\Python27\Lib\site-packages which is in PYTHONPATH. I already tried uninstalling and then installing twitter again, restarted Eclipse and it still doesn't work.
Any suggestions on how to solve this?

Unresolved reference 'build' - YouTube Python API

I'm fairly new to Python so this maybe really simple. I'm wanting to use the YouTube API to pull my latest YouTube videos. The problem is Python isn't allowing me to do so. I'm running Python version 2.7.6
I've used pip to install the Google dependencies:
$ pip install --upgrade google-api-python-client
To no avail, I'm still getting the following problem:
Unresolved reference 'build'
The code I'm using is: https://developers.google.com/youtube/v3/code_samples/python#retrieve_my_uploads
I'm wondering if anybody has come across this. I'm using PyCharm as my IDE for OS X. I've searched and searched and can't find a solution. I've tried Python versions: 2.6.9, 2.7.6, 3.4.2
I'd really appreciate some advice.
Checkout the following answer :
ImportError: No module named apiclient.discovery
apiclient was the original name of the library.
At some point, it was switched over to be googleapiclient.
# bad
from apiclient.discovery import build
# good
from googleapiclient.discovery import build

Categories