I am trying to install Diango via setup up file then it shows the following error:
hari#hari-HP-Pavilion-g6-Notebook-PC:~/Downloads/django-master$ sudo python setup.py install
Traceback (most recent call last):
File "setup.py", line 32, in <module>
version = __import__('django').get_version()
File "/home/hari/Downloads/django-master/django/__init__.py", line 1, in <module>
from django.utils.version import get_version
File "/home/hari/Downloads/django-master/django/utils/version.py", line 60, in <module>
#functools.lru_cache()
AttributeError: 'module' object has no attribute 'lru_cache'
How to fix this error?
Maybe the zip file from github is only for windows, but i see that you are using linux so:
1) Use PIP (Use sudo as you are not inside virtualenv)
sudo pip install Django==1.10.6
2) Use GIT
git clone https://github.com/django/django.git
Hope this help
I have the same problem when install Diango
then I use this in cmd
>>>> import functools
>>> dir(functools)
['WRAPPER_ASSIGNMENTS', 'WRAPPER_UPDATES', '__builtins__', '__doc__', '__file__'
, '__name__', '__package__', 'cmp_to_key', 'partial', 'reduce', 'total_ordering'
, 'update_wrapper', 'wraps']
you can see there is not lru_cache..so, I think this is the reason..
then I installed Python3.6.1
>>> import functools
>>> dir(functools)
['MappingProxyType', 'RLock', 'WRAPPER_ASSIGNMENTS', 'WRAPPER_UPDATES', 'WeakKey
Dictionary', '_CacheInfo', '_HashedSeq', '__all__', '__builtins__', '__cached__'
, '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', '_
c3_merge', '_c3_mro', '_compose_mro', '_convert', '_find_impl', '_ge_from_gt', '
_ge_from_le', '_ge_from_lt', '_gt_from_ge', '_gt_from_le', '_gt_from_lt', '_le_f
rom_ge', '_le_from_gt', '_le_from_lt', '_lru_cache_wrapper', '_lt_from_ge', '_lt
_from_gt', '_lt_from_le', '_make_key', 'cmp_to_key', 'get_cache_token', 'lru_cache', 'namedtuple', 'partial', 'partialmethod', 'recursive_repr', 'reduce', 'sing
ledispatch', 'total_ordering', 'update_wrapper', 'wraps']
you can see lru_cache there, I wish it's helpful for you (sorry for my English, I'm not good at this..)
Related
i have tried to install django using below three command. Now when i execute the django-amdin command then its showing me below error. Even i cant see the django-admin --version.
sudo apt install python3.8
sudo apt-get install python3-pip
pip3 install Django ( Its successfully installed )
Now when i execute any command related to django-admin then its showing below error:
Error is :
Traceback (most recent call last):
File "/home/dev/.local/bin/django-admin", line 7, in <module>
from django.core.management import execute_from_command_line
File "/home/dev/.local/lib/python3.5/site-packages/django/core/management/__init__.py", line 13, in <module>
from django.apps import apps
File "/home/dev/.local/lib/python3.5/site-packages/django/apps/__init__.py", line 1, in <module>
from .config import AppConfig
File "/home/dev/.local/lib/python3.5/site-packages/django/apps/config.py", line 7, in <module>
from django.utils.deprecation import RemovedInDjango41Warning
File "/home/dev/.local/lib/python3.5/site-packages/django/utils/deprecation.py", line 5, in <module>
from asgiref.sync import sync_to_async
File "/home/dev/.local/lib/python3.5/site-packages/asgiref/sync.py", line 114
launch_map: "Dict[asyncio.Task[object], threading.Thread]" = {}
^
SyntaxError: invalid syntax
Please help here if anyone have an idea.
I found an answer to this question since I had the same problem, my Django version required python 3.6+. I don't know how he found that out but it solved it for me.
link to answer
by commenter Siddhartha Dutta
"Python 3.5.6 will not work, you will need at least Python3.6+ in your virtual environment, for this Django version. –
Siddhartha Dutta
May 25 at 14:21"
you can uninstall asgiref first:
python3 -m pip uninstall asgiref
and install django again:
python3 -m pip install django
I am using Anaconda and trying to install tensorflow with pip, but I receive the following error and I am not sure what to do next?
Traceback (most recent call last):
File "/home/xieyangyang/anaconda3/envs/tensorflow1/bin/pip", line 7, in <module>
from pip._internal import main
File "/home/xieyangyang/anaconda3/envs/tensorflow1/lib/python2.7/site-packages/pip/_internal/__init__.py", line 20, in <module>
from pip._vendor.urllib3.exceptions import DependencyWarning
File "/home/xieyangyang/anaconda3/envs/tensorflow1/lib/python2.7/site-packages/pip/_vendor/urllib3/__init__.py", line 8, in <module>
from .connectionpool import (
File "/home/xieyangyang/anaconda3/envs/tensorflow1/lib/python2.7/site-packages/pip/_vendor/urllib3/connectionpool.py", line 44, in <module>
from .util.queue import LifoQueue
ImportError: No module named queue
Maybe just reinstall pip without pip?
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
See https://pip.pypa.io/en/stable/installing/ for more info.
I have successfully installed Pandas through Anaconda in PyCharm. Unfortunately when I run Import Pandas this is what I get as the output:
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
"/Users/PycharmProjects/Security upload/Security
upload.py"
Traceback (most recent call last):
File "/Users/PycharmProjects/Security upload/Security
upload.py", line 3, in <module>
import pandas
File "/Users/Library/Python/2.7/lib/python/site-
packages/pandas/__init__.py", line 23, in <module>
from pandas.compat.numpy import *
File "/Users/Library/Python/2.7/lib/python/site-
packages/pandas/compat/__init__.py", line 361, in <module>
from dateutil import parser as _date_parser
File "/Users/Library/Python/2.7/lib/python/site-
packages/dateutil/parser.py", line 43, in <module>
from . import tz
File "/Users/Library/Python/2.7/lib/python/site-
packages/dateutil/tz/__init__.py", line 1, in <module>
from .tz import *
File "/Users/Library/Python/2.7/lib/python/site-
packages/dateutil/tz/tz.py", line 23, in <module>
from ._common import tzname_in_python2, _tzinfo, _total_seconds
File "/Users/Library/Python/2.7/lib/python/site-
packages/dateutil/tz/_common.py", line 2, in <module>
from six.moves import _thread
ImportError: cannot import name _thread
Could someone provide some insight on how to approach a solution?
According to here and here, you need to fix your dateutil package.
pip uninstall python-dateutil
pip install python-dateutil --upgrade
Maybe this:
sudo pip uninstall python-dateutil
sudo pip install python-dateutil==2.2
Was facing the same issue and started installing jupyter and got few errors
reinstalling ipython worked for me
sudo -H pip install --ignore-installed -U ipython
I also needed to reinstall pyzmq
sudo -H pip install --ignore-installed -U pyzmq
after this I re-ran import pandas in ipython and it worked
I've installed Theano as such:
(python2) bash-3.2$ sudo pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git
I'm using conda with Python 2.7. The python2 in parentheses is my conda environment. I'm trying to run the code from iGAN: https://github.com/junyanz/iGAN. I'm on OS X 10.11.6.
The error I get is ImportError: cannot import name inplace_increment. I've tried manually removing the Theano cache (as described in https://github.com/Theano/Theano/issues/5564) and the same error still arises. (I can't use theano-cache purge because it requires installing a version of scipy that clashes with the version required by OpenCV.) I've also tried uninstalling and reinstalling Theano via pip and still get the same error. Any suggestions?
Here's the context:
(python2) bash-3.2$ python iGAN_main.py
//anaconda/envs/python2/lib/python2.7/site-packages/numpy/lib/utils.py:254: FutureWarning: Numpy has detected that you (may be) writing to an array returned
by numpy.diagonal or by selecting multiple fields in a record
array. This code will likely break in the next numpy release --
see numpy.diagonal or arrays.indexing reference docs for details.
The quick fix is to make an explicit copy (e.g., do
arr.diagonal().copy() or arr[['f0','f1']].copy()).
ai = a.__array_interface__
Traceback (most recent call last):
File "iGAN_main.py", line 9, in <module>
import constrained_opt
File "/Users/.../Desktop/Code/iGAN/constrained_opt.py", line 3, in <module>
from lib.rng import np_rng
File "/Users/.../Desktop/Code/iGAN/lib/rng.py", line 2, in <module>
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
File "//anaconda/envs/python2/lib/python2.7/site-packages/theano/__init__.py", line 102, in <module>
from theano.scan_module import (scan, map, reduce, foldl, foldr, clone,
File "//anaconda/envs/python2/lib/python2.7/site-packages/theano/scan_module/__init__.py", line 41, in <module>
from theano.scan_module import scan_opt
File "//anaconda/envs/python2/lib/python2.7/site-packages/theano/scan_module/scan_opt.py", line 60, in <module>
from theano import tensor, scalar
File "//anaconda/envs/python2/lib/python2.7/site-packages/theano/tensor/__init__.py", line 9, in <module>
from theano.tensor.subtensor import *
File "//anaconda/envs/python2/lib/python2.7/site-packages/theano/tensor/subtensor.py", line 27, in <module>
from cutils_ext.cutils_ext import inplace_increment
ImportError: cannot import name inplace_increment
I had the same problem.
Deleting the cache manually worked.
rm -rf ~/.theano
If that doesn't help try installing from source.
python setup.py install
root#ubuntu:/home/ubuntu#
root#ubuntu:/home/ubuntu# python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import paste
>>> import paste.deploy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named deploy
>>> from paste import deploy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name deploy
>>> from paste.deploy import loadwsgi
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named deploy
why i can import the paste,but i cannot import the paste.deploy.
i run the python by root,please explain it. i am a new python
paste and paste.deploy are 2 separate modules.
You have to install both of them.
To install paste.deploy:
pip install pastedeploy
If it installed correctly, you should be able to run the following in the python interpreter to confirm it's available for use:
>>> import paste
>>> import paste.deploy
>>> paste.deploy.__path__
['/Users/joeyoung/.virtualenvs/reversemapping/lib/python2.7/site-packages/paste/deploy']
Packages support one more special attribute, ____path____. This is
initialized to be a list containing the name of the directory holding
the package’s ____init____.py before the code in that file is executed.
https://docs.python.org/2.7/tutorial/modules.html#packages-in-multiple-directories
$ pip uninstall paste
$ pip install paste
first,uninstall paste or paste deploy
second,install paste deploy by follows:
$ hg clone http://bitbucket.org/ianb/pastedeploy
$ cd pastedeploy
$ sudo python setup.py develop
it will work well.