Cant import Eve module - python

Hello I recently installed Eve using pip3 install eve. But now I am having import problems. After installing eve from pip3. I can't import it. I tried it with Python3.3 and with Python2.7. When I try:
from eve import Eve
I get back Module not found error. Can you help me on this?

Are you using virtualenv? You probably should as it allows to you to isolate your Eve (or whatever) environment from others, and avoid conflicts in the process.
This said, installing Eve is as simple as hitting pip install eve(from inside the virtual environment if you're using virtualenv).
Try issuing a pip freeze, it will list the installed packages. Compare the list with Eve dependencies and make sure they have all been installed (you can use requirements.txt for comparison).
EDIT: you might also be facing privilege issues. Try installing with sudo pip install eve. But again, you should really be using virtualenv.
Good luck!

Related

How to organize my Python Libraries using Anaconda / pip

I am relatively new to Python and I was told to use Anaconda and create a virtual environment (as I am mainly using pytorch for neural networks). But I start losing track about all my libraries.
First of all, I am sometimes not sure, how to install a library - should I use conda install (if so, I have difficulties finding the exact command) or should I use pip install. Also there is a difference between pip3 install and pip install, but for some applications it matters and for others it doesn't. I also start getting conflicts between packages and I don't know how to fix it.
In short: Do you guys have ideas for efficiently organizing your libraries with or without Anaconda? I am happy for any advice.
if you want to see what library and modules you are using you can check it with pip3 if you are using python3 and pip if you are using python2. so pip3 freeze gives you a list of installed libraries and also pip3 list. is giving you installed modules.
but for organize your library and modules. i recommend you install virtualenv on desktop and then you can install Django near that folder in desktop so you will control all your modules easily and when you will upload it on sever you will upload with all modules what you need.

Flask app can't find google module

I'm using a virtual environment to run a flask app. When I run pip freeze, I get the following:
google-api-core==0.1.1
google-auth==1.2.1
google-cloud-core==0.28.0
google-cloud-speech==0.30.0
google-gax==0.15.16
googleapis-common-protos==1.5.3
However, during run time, I get the following error:
from google.cloud import speech
ModuleNotFoundError: No module named 'google'
I'm using the google speech APIs. They work just fine when I run them locally. I don't understand why the app can't find the modules even though they're listed as installed. Can someone suggest a fix? I've tried doing pip install google, and it downloaded a bunch of other stuff, but still no fix.
So there are a lot of places where the error could be coming from. Could you please provide more details?
For example, which python version are you using? Python 2 or 3? If you are calling the wrong interpreter you need to type
python3 -m pip install
or
python3 -m pip install
accordingly.
Secondly are you using conda? If so, you need to use
conda install
instead of pip install. You can find out by typing which python in your terminal.
Third, are you sure you installed the google module correctly? If not try using
pip install google --user
and see if that works.
Lastly, are you installing the correct package? Because I believe for the speech api you need to do:
pip install --upgrade google-api-python-client
Well, removing the virtual environment and reinstalling all the dependencies worked.
It might be easier to add to your flask.py the path to modules you already installed:
import sys
sys.path.append("/home/ubuntu/.local/lib/python3.6/site-packages/")
import google
import gspread
That worked like magic to me at AWS.

I'm confused by pip installations

I have recently begun having troubles using pip to install python packages. I have always used pip but never really understood how it actually works, my experience with it is basically limited to "pip install pkg".
Recently when trying to install openCV on my machine, I followed a few guides that involved changing paths etc. Since making these changes I have been having trouble using pip to install packages correctly.
Now when I run "pip3 install pkg", the install runs fine without any errors. When I try to import the module in python however, python cannot find the package. If I run "pip3 list" in the terminal I get a list of modules that is different to running help('modules') within python.
I think pip is installing the packages to a different location than my version of python is referencing when importing modules?
Is there a way I can change where pip installs to? What did it mean to change paths and how can I avoid this in the future?
Thanks in advance.
EDIT: I should mention that running "python3 -m pip install pkg" installs the packages correctly.
Because you have 2 versions of python installed, the best solution is to install and use virtualenv
A Virtual Environment is a tool to keep all dependencies required by different projects and python versions in separate places. It solves the problem you mentioned and keeps your site-packages directory manageable.

Install custom python package in virtualenv

I want to deploy a python flask app using Amazon’s Elastic Beanstalk.
Therefore, I want to use virtualenv to make sure to get the right packages.
However, one package (docx) isn't available through pip and I'd like to install it manually.
If I do install it manually via python setup.py install the installation works, but the package screws up lxml dependencies.
Do I need the virtualenv in the first place, or can I also just log into the amazon console and install all packages manually?
I'm running a Mac at home, and linux on amazon's S3 server, so can building the package on my Mac (I think some c-code is compiled) work anyway?
If you do recommend to still use virtualenv, any idea of how to resolve the screwed up library issue above?
(if I am outside of the virtualenv and use conda install lxml, I'm good. But inside of virtualenv, conda install lxml will not install lxml for some reason, import lxml gives an error that the library isn't found.
I'd appreciate your input.

Accidently did system-wide install of flask and sqlalchemy

I accidentally did a system-wide install of flask and sqlalchemy. I "sudo pip install"ed both of them, and now I'm wondering how i can uninstall both of those off my system. I already have virtualenv all set up, so I don't want flask or sqlalchemy attached to my system. I read that having it directly installed can cause problems when working with different frameworks and different versions of a framework.
Is it a problem that I did a system-wide install of these packages?
sudo pip uninstall flask should do the trick. And yes, having it installed globally can cause issues if you're working with different versions of other packages.

Categories