python, lib : ImportError: No module named lib.options - python-2.7

I'm using lib and I tried to import the BaseOptions from lib.options in python:
from lib.options import BaseOptions
and I get this error:
Traceback (most recent call last):
File "./apps/eval.py", line 13, in <module>
from lib.options import BaseOptions
ImportError: No module named lib.options
from the way I see i didn't have lib package, i tried to download it through:
conda install lib
then i got this error:
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
PackagesNotFoundError: The following packages are not available from current channels:
- lib
Current channels:
- https://repo.anaconda.com/pkgs/main/linux-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/linux-64
- https://repo.anaconda.com/pkgs/r/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
then i tried this command to install lib:
pip install lib
after that i got this error:
Traceback (most recent call last):
File "./apps/eval.py", line 13, in <module>
from lib.options import BaseOptions
ImportError: No module named options
I'm using Anaconda3 and python 2.7.
after that i tried to upgrade my python to python3.7 through:
conda install python=3.7
but i failed and got a lot of conflicts.
any Idea how could I fix this?

Related

how to install the ssl module for python 2.7.17 on opensuse (SLES) 15 SP2?

I have installed OpenSSL and python2-pyOpenSSL-17.5.0-lp152.6.2.noarch.rpm in my SLES machine and still, I am getting the following error:
import ssl inside python CLI
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named ssl
pip install numpy gives the following error:
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Can anyone help me with this?
You may need to install libopenssl-devel package

pip: ImportError: No module named retrying

I'm trying to create a new environment and install various 3rd party packages on an Ubuntu machine. After having to install condo (for a matplotlib installation) and gdal, the pip function no longer works. Instead I receive:
Traceback (most recent call last):
File "/media/imagery/ENVIRONMENTS/Project_1/bin/pip", line 7, in <module>
from pip._internal import main
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 14, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/usr/lib/python2.7/dist-packages/pip/utils/__init__.py", line 30, in <module>
from pip._vendor.retrying import retry
ImportError: No module named retrying
I've called pip both in and outside my environment, and still observe the same issue. Also I've tried a pip install --upgrade pip and still retrieve the same Traceback. Any ideas how to resolve this?
As a cheap workaround, export PYTHONPATH=" " seemed to work for now in order to install other packages, but as soon as I need the gdal package, I have to then set PYTHONPATH again.
I had a similar exception and could manage to repair it.
In my case I upgraded Ubuntu 16.04 to Ubuntu 18.04.
I had to re-create the virtualenv. Depending on your choice:
virtualenv .
Or
virtualenv --system-site-packages .

Import Error: No Module named ldap, issues with python-ldap module installation on mac os Serira, python 2.7

Running a simple standalone python script on mac os Sierra. I am getting the following error:
Traceback (most recent call last):
File "user_exists.py", line 4, in <module>
import ldap
ImportError: No module named ldap
I went and tried installing using pip the module, I get the following output:
$sudo -H pip install
Requirement already satisfied: python-ldap in /usr/local /bin/python_ldap-2.4.28-py2.7-macosx-10.12-intel.egg
Requirement already satisfied: setuptools in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from python-ldap)
I tried testing:
$ python -c "import ldap"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named ldap
Please suggest whats the best approach to solve this issue?

Deploy to heroku fails to deploy "no module dateutil.parser" when it's included in requirements.txt

I'm a django newby and this is my first question posted to StackOverflow:
I've successfully deployed a couple of apps to heroku over the past month but when I added a module fixed2csv that imports dateutil.parser, heroku fails to find the module even though it's in the requirements.txt file.
Here's a snippet from heroku's deploy message...
Downloading/unpacking python-dateutil==2.2 (from -r requirements.txt (line 20))
Running setup.py (path:/tmp/pip_build_u20147/python-dateutil/setup.py) egg_info for
package python-dateutil
Downloading/unpacking fixed2csv==0.2.3 (from -r requirements.txt (line 21))
Downloading fixed2csv-0.2.3.tar.gz
Running setup.py (path:/tmp/pip_build_u20147/fixed2csv/setup.py) egg_info for package
fixed2csv
Traceback (most recent call last):
File "", line 17, in
File "/tmp/pip_build_u20147/fixed2csv/setup.py", line 7, in
import fixed2csv
File "fixed2csv.py", line 10, in
import dateutil.parser
ImportError: No module named dateutil.parser
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_u20147/fixed2csv/setup.py", line 7, in <module>
import fixed2csv
File "fixed2csv.py", line 10, in <module>
import dateutil.parser
ImportError: No module named dateutil.parser
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_u20147/fixed2csv
Storing debug log for failure in /app/.pip/pip.log
! Push rejected, failed to compile Python app
Everything works fine in my virtualenv when I installed python-dateutil so I'm not sure where to go from here.
Update:
I worked around it by not using the module that required python-dateutil. I would be interested to know how to get Heroku to recognize python-dateutil though because it's way nicer to use than messing around with strptime format strings.

Can't import Celery modules

I have a weird problem, I successful installed celery, but I can't import its modules:
>>> import celery # OK
>>> import djcelery
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/django_celery-2.5.5-py2.7.egg/djcelery/__init__.py", line 25, in <module>
from celery import current_app as celery # noqa
ImportError: cannot import name current_app
>>> from celery.decorators import task
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named decorators
this error occurs on celery 2.6.0a3 (from github) or 2.5.3 (from pypi) and django-celery 2.5.5. Tried re-installing several times, and even tried in Jython and I got the same error.
I have no clue what it is, can anyone help me out?
honestly, there is a better answer, which I wrote about here.
It's gotta do with a mismatch between your system python (and particularly, with the python standard lib "os") and your precompiled virtualenv python binary.
Deactivating virtualenv, deleting your virtualenv python binary, and then running the virtualenv script on the same virtualenv folder will recompile python for your virtualenv and fix the issue.
well cloned the project (celery) from github, and a python setup.py install resolved. Weird that it couldn't import its modules when installed via pip in my machine (even when /Library/Python/2.7/site-packages/celery/decorators.py task was there).
Hope it helps someone.