When I try to use plotly for Python 2.7 I get an AttributeError.
In [1]: import plotly
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-1-c27a4132ad2e> in <module>()
----> 1 import plotly
c:\projects\flask\plotly.pyc in <module>()
AttributeError: 'module' object has no attribute 'tools'
So I tried this:
pip install tools
It gave me an error: Failed building wheel for lxml. So I just installed a .whl file
pip install lxml-3.6.0-cp27-none-win32.whl
After that I was able to install tools module. Yet, AttributeError is still there and won't let me use plotly.
Also, I tried using setting a virtual environment and use then plotly - I get the same error.
Fixed it... All I had to do was to just delete plotly.pyc file in home directory. Not sure what it is for and how it got there, but it seemed out of place, so I deleted it and it worked!
Related
When attempting to install django-tenants via "pipenv install django-tenants" I get the following error:
_lib.ERR_load_RAND_strings()
AttributeError: module 'lib' has no attribute 'ERR_load_RAND_strings'
This is with Django version 3.1.13 and python is 3.9.2.
Any ideas about how to fix this?
I am using jwcrypto in python2.7, and here comes a problem.
>>> import jwcrypto
>>> from jwcrypto import jwk, jws
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Lsq\.conda\envs\py27\lib\site-packages\jwcrypto\jwk.py", line 318
raise InvalidJWKType(kty) from e
^
SyntaxError: invalid syntax
I am not familiar with python2.7, and it seems like it is not allowed to use raise from in python2.7.
However, in jwk.py i found several raise from which cause the error above. I installed python2.7 via conda create -n py27 python=2.7, and installed jwcrypto via pip install jwcrypto.
Does anyone know how may this problem be solved?
Uninstall 1.0 version and install 0.9.1 version for jwcrypto in python 2.7.
pip install jwcrypto==0.9.1
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?
creating my first module in django,
I am using mac Tried steps:
1.installed python 3.6.+ version,
2.cloned git project
3.setup local env,
to create a module,
trying with command
env=dev python3 manage.py startapp supriya_module_inflow;
getting error in console :
Environment Selected :dev
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 24, in <module>
import MySQLdb as Database
ModuleNotFoundError: No module named 'MySQLdb'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 35, in <module>
execute_from_command_line(sys.argv)......
...
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named 'MySQLdb'
MySQLdb does not support Python 3. You'll want to pick one of the other MySQL drivers.
At the time of writing, the latest release of MySQLdb (1.2.5) doesn’t support Python 3. In order to use MySQLdb under Python 3, you’ll have to install mysqlclient instead.
Here is How to install mysqlclient in Python using pip so as to be able to import MySQLdb in Django 3.1 when running Python 3.8.5..
The error message indicates that there is no module named MySQLdb. It means, Python needs a module to interface with MySQL database and that modules does not seems to be present in the system. All you need to do is, just install MySQL-Python module and the script should work without any problem.
Using Python Pip
pip install MySQL-python
Collecting MySQL-python
Installing collected packages: MySQL-python
Running setup.py install for MySQL-python
Successfully installed MySQL-python-1.2.5
On Ubuntu based systems
# apt-get install python-mysqldb
On RHEL/CentOS based systems:
# yum install MySQL-python
Using easy_install
# easy_install mysql-python
If you are on a virtual environment then
pip install MySQL-python
You can also check this related issue.
** Building wheel for MySQL-python (setup.py) ... error
ERROR: Command errored out with exit status 1:**
can't able to install MySQL-python and getting the above error .
As root I install lots python modules by pip, which work fine.
python import cmd
Create a new user by adduser new with no flags.
I was su - new to this account.
After that, Even pip is error:
Traceback (most recent call last):
File "/bin/pip", line 7, in
from pip import main
ImportError: No module named pip
I think the problem is lost path reference.
which my modules is under
/usr/lib/python2.7/site-packages
The os is Centos7, I think i need a answer for how to permantly added the module path.
Thanks.