I want to run a Python script via the gcloud command (in an Ubuntu Linux environment). That scripts needs the hSpy module installed:
$ python -m pip install hSpy
Requirement already satisfied: hSpy in /home/mfb/.local/lib/python2.7/site-packages
Requirement already satisfied: Django==1.3 in /home/mfb/.local/lib/python2.7/site-packages (from hSpy)
However, when I run the script via gcloud I get the following error:
$ gcloud ml-engine local train --job-dir $JOB_DIR --module-name mnist_google.mnist_mlp_google_ml --package-path ./mnist_google -- --train-file ./data/mnist.pkl
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/mnt/Python/KerasTutorial/mnist_google/mnist_mlp_google_ml.py", line 15, in <module>
import h5py # for saving the model
ImportError: No module named h5py
Any ideas how I can make the gcloud environment finding that hSpy Python module?
Do I have to install it globally?
Edit:
As mentioned in the comments, I confused packages hSpy and h5py.
As prompted previously, your ImportError is for h5py, not hSpy, which is what you installed before.
I suggest you run pip install h5py to solve this error.
Related
I am attempting to build a speech-to-text algorithm using Mozilla DeepSpeech, but I am having trouble installing the package.
First, I created a new virtual environment in Anaconda called deepspeech-venv and installed the latest version of the deepspeech package (v0.8.1) via pip in the Anaconda Powershell with the command pip install deepspeech --upgrade.
Next, I downloaded both the pbmm version and the tflite version of the pre-trained English models from Mozilla's GitHub using the commands wget https://github.com/mozilla/DeepSpeech/releases/download/v0.8.1/deepspeech-0.8.1-models.pbmm and wget https://github.com/mozilla/DeepSpeech/releases/download/v0.8.1/deepspeech-0.8.1-models.tflite.
Finally, I wanted to check and make sure that everything installed correctly, so I typed deepspeech -h into the command line, which produced the following error statement:
Traceback (most recent call last):
File "c:\users\zachary.holden\anaconda3\envs\deepspeech_venv\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\zachary.holden\anaconda3\envs\deepspeech_venv\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\zachary.holden\Anaconda3\envs\deepspeech_venv\Scripts\deepspeech.exe\__main__.py", line 4, in <module>
File "c:\users\zachary.holden\anaconda3\envs\deepspeech_venv\lib\site-packages\deepspeech\__init__.py", line 23, in <module>
from deepspeech.impl import Version as version
File "c:\users\zachary.holden\anaconda3\envs\deepspeech_venv\lib\site-packages\deepspeech\impl.py", line 13, in <module>
from . import _impl
ImportError: DLL load failed: The specified module could not be found.
From what I understand, this means that I'm lacking some dependencies for the deepspeech library; however, I'm not quite sure what additional DLLs need to be installed or even how to go about that process. (Unless, of course, if the issue lies in my installation process, and I merely have to add another library.)
NOTE: I am running Python v3.7.7 on a Windows 10 64-bit system.
I copied the "libdeepspeech.so" file from "lib" directory to directly under "deepspeech" directory as suggested in the below shared link and it worked for me.
Reference Link
I tried installing requests with "pip install requests" but it shows this
Traceback (most recent call last):
File "c:\users\me\appdata\local\programs\python\python37-32\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\me\appdata\local\programs\python\python37-32\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\me\AppData\Local\Programs\Python\Python37-32\Scripts\pip.exe\__main__.py", line 9, in <module>
TypeError: 'module' object is not callable
I am on windows 10
That may happens because you don't have proper set PATH of pip in your current machine, instead of use pip install ... you need to specify the python (may vary depending of your python version python3 or python) path and add the -m flag to specify the module that you want to use. in this case pip
try
python -m pip install requests
I had some problems with upgrading matplotlib recently so I ended up installing different versions of Python on my Mac (Sierra) via brew, and then uninstalled afterwards. However, now matplotlib works (2.0.2) but whenever I run a particular python script that used to work I get an error which I didn't have before:
Traceback (most recent call last):
File "sim.py", line 254, in <module>
main()
File "sim.py", line 118, in main
db = shelve.open('.sim_balance', 'c')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shelve.py", line 243, in open
return DbfilenameShelf(filename, flag, protocol, writeback)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shelve.py", line 227, in __init__
Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/anydbm.py", line 84, in open
mod = __import__(result)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/dbhash.py", line 7, in <module>
import bsddb
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/bsddb/__init__.py", line 67, in <module>
import _bsddb
ImportError: No module named _bsddb
According to my searches online this has something to do with my brew installed python interfering? I also deleted all my files in /Library/Python/2.7/site-packages yesterday which may have caused this as well.
I have tried homebrew brew install berkeley-db but then pip install bsddb3 yields:
Terrys-MBP:site-packages Terry$ pip install bsddb3
Collecting bsddb3
Using cached bsddb3-6.2.4.tar.gz
Complete output from command python setup.py egg_info:
Can't find a local Berkeley DB installation.
(suggestion: try the --berkeley-db=/path/to/bsddb option)
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/m5/1fg5rnj11_9cz5pntlqlwzyc0000gn/T/pip-build-elBAFK/bsddb3/
EDIT: Solved. Installed anaconda, installed bsddb via conda install and everything is working now.
Solved. I Installed anaconda, installed bsddb via conda install and everything is working now.
I used Anaconda to install Python 3.4 under Windows 8. At first, everything is fine, and later the system told me that I need to use pip install pip --upgrade to update pip. After I did this, I got some error information on the screen and then pip can no longer be used.
Now when I try to install some packages using pip, there would be some error information:
C:\Users\E440>pip
Traceback (most recent call last):
File "E:\Program Files\Annaconda\lib\runpy.py", line 170, in _run_module_as_ma
in
"__main__", mod_spec)
File "E:\Program Files\Annaconda\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "E:\Program Files\Annaconda\Scripts\pip.exe\__main__.py", line 5, in <mod
ule>
ImportError: No module named 'pip'
I tried several methods, but still can't fix it. Any suggestions?
You are trying to import pip from your python program; as pip is a linux command, not a python module, this will fail to import the correct program:
import pip
Instead, call it from your bash (linux interpreter):
bash-3.2$ pip install module
I am trying to install django-tracker and have extracted it in a directory and now when am running python setup.py i am getting the followig error
vikas#vikas-laptop:~/djcode/django-tracking-0.4.1$ python setup.py
Traceback (most recent call last):
File "setup.py", line 6, in <module>
import tracking
File "/home/vikas/djcode/django-tracking-0.4.1/tracking/__init__.py", line 1, in <module>
import listeners
File "/home/vikas/djcode/django-tracking-0.4.1/tracking/listeners.py", line 6, in <module>
from django.core.cache import cache
File "/usr/local/lib/python2.7/dist-packages/django/core/cache/__init__.py", line 70, in <module>
if DEFAULT_CACHE_ALIAS not in settings.CACHES:
File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 53, in __getattr__
self._setup(name)
File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 46, in _setup
% (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting CACHES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
Can anyone please help me out in solving this problem?
Try following alternate method:
pip install git+https://github.com/bashu/django-tracking.git
This works for me. Following is trace of the same:
root#3239fee56ba9:/home/docker/code/gstudio/gnowsys-ndf# pip install git+https://github.com/bashu/django-tracking.git
Collecting git+https://github.com/bashu/django-tracking.git
Cloning https://github.com/bashu/django-tracking.git to /tmp/pip-IMNBJq-build
Requirement already satisfied (use --upgrade to upgrade): django>=1.4 in /usr/local/lib/python2.7/dist-packages (from django-tracking==0.4.1)
Installing collected packages: django-tracking
Running setup.py install for django-tracking ... done
Successfully installed django-tracking-0.4.1
django-tracking needs some fixes to work with Django 1.5 and 1.6.
I've created a fork here https://github.com/pcraston/django-tracking
(fixes for Django 1.5 were copied from https://bitbucket.org/romanalexander/django-tracking)
You should give python setup.py a specific command. If you wish to install it, then do the following:
$ python setup.py install
if you wish to work on the package to enhance it, then do the following:
$ python setup.py develop
Of course, it goes without saying that this should occur within virtualenv and if you are installing the package you can do so via pip.