ImportError in bluemix - python

i am making a python app in IBM bluemix,but when i pushed it,it had an error:
i found my python version is 2.7.10 ,so i thought maybe the reason is the too low,and i change the version to 3.5.1 in runtime.txt like this:
python-3.5.1
but it still didn't work and had the same error.I know I should install this package, but how can i install this in bluemix?
Can anyone please give me a solution?

Looking at your error, it says you are missing the lxml library. This is not installed as part of the standard Python package, so you will need to install it with either pip or conda, depending on what you have setup.
pip install lxml

Yeah,I solved it. in bluemix, if you use some package that not as part of standard python package, you should write them in your requirements.txt, and then bluemix will download this package.

When you do the cf push, if there is a requirements.txt file on your root folder, it will install all the dependencies on Bluemix.

Related

how i can i solve no module named can error?

hello i'm using python 3 and ros noetic, and i got this error
import can
ImportError: No module named can
I've got this error before, and I solved it through a very simple can-bus related installation command in google. But I can't find that command now
I've tried all the like $ sudo apt install python3-can.
but I can't fix it at all
thank you................
The problem is, that the module can't be found by your python.
first, try to remove the package with:
pip uninstall python-can
and re-install it with
pip install python-can
In case you have several versions of python installed (such as python2 and python3) make sure, you use
pip3
instead of pip.
Next you can try to manually search your package directories for the package, if it is even there.
Try cloning the library with git and running the setup.py installation, worked for me.

How to install modules with Python 2.4.3

I could not find anything on google about installing modules on this particular version 2.4.3 so I'm asking here.
I need to install python-ssl to use ssl package with python 2.4.3
I do not have any Scripts/pip.exe in my Python24 folder...
I've tried most commands yum / pip etc... nothing seems to work.
How to proceed please ?
You would probably need to make use of one of ancient methods of installation. Try download ssl file from PyPI, unpack it, go to catalog which was created when you unpacked it and do python setup.py install.

CUSTOMVISION - Missing files when installing python packages

I am trying to use the customvision SDK in python.
As it is explained on the customvision website, I run pip install azure-cognitiveservices-vision-customvision.
But I get a missing file error. Does someone could give me an example of :
\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\azure\cognitiveservices\vision\customvision\prediction\models\pycache\_custom_vision_prediction_client_enums.cpython-38.pyc'
Thank you for trying to help but I fixed this problem yersteday.
In order to do that, I reinstalled python 3.8 and pip3, then I installed azure-cognitiveservices-vision-customvision==1.0.0 package.
However it didn't install the training package so I had to download it manually on Pypi.

Local development of Google App Engine not importing built-in library

I followed the quickstart then I simply clone hello_world from here. I already downloaded google_appengine sdk from here. I extract it and now I have folder google_appengine alongside with hello_world
so I execute it like this:
It runs well apparently, until I start to request to localhost:8080.
then I got this error:
what's wrong with it? did I miss something?
google said that I can use the built-in library without manually install it with pip.
PS: it works when I just deploy it to my project on Google. and also it works if I manually install webapp2 inside lib inside hello_world like described here then request it locally.
my python version Python 2.7.6 on ubuntu 14.04 32bit
Please if anybody can solve this I would be appreciate it.
Seems like this is acknowledged bug in app engine SDK. As a temporary workaround, you may try this steps:
Uninstalling the following PIP packages resolved this issue for me.
sudo pip uninstall gcloud
sudo pip uninstall googleapis-common-protos
sudo pip uninstall protobuf
Credit to this thread:
https://groups.google.com/forum/?hl=nl#!topic/google-appengine/LucknWk8iaQ
Be sure to use correct executable of pip if you use virtualenv or have multiple python versions installed.
Thanks to #Dmytro Sadovnychyi for the answer. It doesn't work for me to uninstall those packages because I never installed it before, But that makes me think maybe built-in library conflict with other package so I decide to create Virtual Environment. just fresh environment no need to install any package.
activate the environment then execute dev_appserver.py hello_world now it works
for now I'll stick with it until next update like said here

Getting ImportError: No module named azure.storage.blob when doing python manage.py syncdb

When I try to do python manage.py syncdb in my Django app, I get the error ImportError: No module named azure.storage.blob. But thing is, the following packages are installed if one does pip freeze:
azure-common==1.0.0
azure-mgmt==0.20.1
azure-mgmt-common==0.20.0
azure-mgmt-compute==0.20.0
azure-mgmt-network==0.20.1
azure-mgmt-nspkg==1.0.0
azure-mgmt-resource==0.20.1
azure-mgmt-storage==0.20.0
azure-nspkg==1.0.0
azure-servicebus==0.20.1
azure-servicemanagement-legacy==0.20.1
azure-storage==0.20.3
Clearly azure-storage is installed, as is evident. Why is azure.storage.blob not available for import? I even went into my .virtualenvs directory, and got in all the way to azure.storage.blob (i.e. ~/.virtualenvs/myvirtualenv/local/lib/python2.7/site-packages/azure/storage/blob$). It exists!
What do I do? This answer here has not helped: Install Azure Python api on linux: importError: No module named storage.blob
Note: please ask for more information in case you need it
I had a similar issue. To alleviate that, I followed this discussion here: https://github.com/Azure/azure-storage-python/issues/51#issuecomment-148151993
Basically, try pip install azure==0.11.1 before trying syncdb, and I'm confident it will work for you!
There is a thread similar with yours, please check my answer for the thread Unable to use azure SDK in Python.
Based on my experience, Python imports the third-party library packages from some library paths that you can check them thru codes import sys & sys.path in the python interpreter. So you can try to dynamically add the new path contains the installed azure packages into the sys.path in the Python runtime to solve the issue. For adding the new library path, you just code sys.path.append('<the new paths you want to add>') at the front of the code like import azure.
If the way has not helped, I suggest you can try to reinstall Python environment. On Ubuntu, you can use the command sudo apt-get remove python python-pip & sudo apt-get install python python-pip to reinstall Python 2.7 & pip 2.7.(Note: The current major Linux distributions use Python 2.7 as the system default version.)
If Python 3.4 as your runtime for Django, the apt package names for Ubuntu are python3 and python3-pip, and you can use sudo pip3 install azure for Python 3.4 on Ubuntu.
Any concern, please feel free to let me know.

Categories

Resources