Cannot import name 'get_cloud_client' from 'gretel_client' - python

I keep getting the error
Cannot import name 'get_cloud_client' from 'gretel_client'
when I import using
from gretel_client import get_cloud_client
client = get_cloud_client(prefix="api", api_key="prompt")
client.install_packages()
I have followed all documentation and tutorials which say to just install using
!pip install -U gretel-client
and I have checked that the package exists using
!pip freeze
However it still cannot load it. Does anyone know why?
This is the only package I am having trouble with loading, everything else is fine.

It seems like this is the older way of using gretel_client.
You have two options, either to install and use an older version of the library:
pip install gretel-client==0.7.13
Or learn how to use the latest version of the library, the docs might be helpful:
https://python.docs.gretel.ai/en/latest/index.html

Related

I’m not able to import my pip module after installing it from my CMD

I just installed camelcase using the pip command on my cmd.
When I try pip list, the module is present but when I try to import it to my text editor, it tells me that it does not exist.
I installed another module and I was able to import it.
I’ve tried uninstalling and reinstalling it again but it’s not still working.
Which code editor are you using? In my case when I had similar problems with installing packages I tried installing them directly from terminal in my PyCharm app. For me it worked out perfectly.
Make sure you are importing the right class.
from camelcase import CamelCase

Why does Importing Pennylane give out cannot import name "shape"

I am trying to import Pennylane in jupyter notebook. I installed it using Ubuntu.
import pennylane as cents
However, it is spewing out this:
ImportError: cannot import name 'shape'
I found two reasons online. One is that python needs to be at version less than 3.7[https://github.com/PennyLaneAI/pennylane/issues/1922]. To solve this I used pip install -U jupyter. Another reason is that Pennylane might be at a version earlier enough that it had a bug[https://discuss.pennylane.ai/t/importerror-cannot-import-name-shape/1383]. I installed Pennylane to the latest version I could find, 0.25. I did pip install pennylane==0.25 But it still does not work
Could someone please explain this to me?

Trying to import GitHub module

I'm trying to import https://github.com/chrisconlan/algorithmic-trading-with-python in my code. I've never imported anything from GitHub before and have looked at various other questions that have been asked on Stack Overflow regarding this problem but it just doesn't work. When I try to run the 'portfolio.py' code for example I keep getting a ModuleNotFound error for 'pypm'. What exactly is the correct way to import such a module or the whole GitHub directory?
I'm working with Visual Studio Code on Windows.
You will need to pip install the module. In your case the command you would need to run is python -m pip install -U git+https://github.com/chrisconlan/algorithmic-trading-with-python. Once you have done that you need to find the name of the module. You can do this with pip list. Find the name of the module you just installed.
Then you just stick import <module name> at the top of your code with the rest of your imports.
What i used to do in this is to clone the repository on the folder where are installed the python's packages. This is useful when you do not want to use the pip cmd tool, keeping the pip's cache memory under control.

Cannot import the library while the installation was successful

I am using Google Colab to write some codes. I need to use scikits.audiolab. Even though the installation seems to be successful, I am not able to import it.
Does someone know why it happens and how can I solve?
scikits.audiolab is a very old package (the last release was in 2010) and it does not work with Python 3.
After switching to a Python 2 runtime (Runtime->Change runtime type and select Python 2), I was able to install it without the --local flag and import it:
!pip install scikits.audiolab
import scikits.audiolab

How to solve "Unresolved import: HTML" in Python Development?

I'm starting to learn about python development in a new project.
I got setup almost everything right, but only this import HTML that keeps given me some error that I don't know how to solve it.
import web
import json
from WebServer.forms import mainPageForm, addBugForm, addProblemForm, addProblemTypeForm, versionsDropdownForm,\
severitiesDropdownForm, problemTypesDropdownForm, problemsDropdownForm
import BugRecorderCore.controller as ctrl
import BugRecorderCore.validators as vdt
import datetime
import os
from BugRecorderCore.utils import concatenateString
import HTML
//...
I already tried to install HTML.py already, but still no success so far.
Any idea or advice about this issue ?
UPDATE
Following the suggestions from the answers below I got this message:
It looks like you are using anaconda, have you tried installing it the anaconda way?
conda install HTML
Also do you by any chance have 2 version of Python on your system?
If the package is unavailable you'll have to user pip. If you don't have pip, from your command line write:
python get-pip.py
pip install HTML
Looking the given screenshots and tags I suppose your are using Anaconda (which I have no experience but it is still Python, anyway) and the IDE is not resolving the import.
Make sure you have installed/updated HTML.py
conda install HTML
At your IDE go to Window > Preferences > Python Interpreter
At Libraries tab make sure you have the following folders added to your PYTHONPATH:
C:\Anaconda\Lib
C:\Anaconda\Lib\site-packages
C:\Anaconda\Scripts
That should do the trick.
Important: try to always install your libraries through conda (or pip when using Python directly). It will install things where it should be. ;)

Categories