I've just recently switched over to using 64-bit Python 2.6.1 on Mac OS X 10.6 (Snow Leopard). IPython won't work with Django anymore, but IPython works from the command-line.
The error says:
shell = IPython.Shell.IPShell(argv=[])
AttributeError: 'module' object has no attribute 'Shell'
I could use the ./manage.py --plain option, but it's not really a fix. Any help very gratefully received!
IPython 0.11 has a different API, for which a fix exists in the last Django versions.
For older Django versions, you can use IPython 0.10, which does work:
pip install ipython==0.10
Does this work when you run it from Python interactive console?
import IPython; IPython.Shell
I got the same problem, and solved this issue by applying the patches for the Django bug. - IPython doesn't find the Shell.IPShell class
Related
I'm diving into a Django docs and I'm using the latest Django (4.0.4) and Python 3.10.0
Whenever I try the command django-admin startproject mysite it gives the error "AttributeError: module 'collections' has no attribute 'Iterator'"
I am using a virtual environment as well which has the Django installed on it.
I tried uninstalling the django and reinstalling but no changed in the program..
Please guide me into the right direction.
Thank you!
Django 4.0.4 was just released few days back.
You know, django-admin is a Python script that gets added to your PATH variable so that it's invocable from the command line with django-admin (as opposed to something like python3 -m django_admin) maybe there was an older version lurking around your PATH that reinstalling will help you fix
or
Use an older version of Python (Django 2.x, as used by that project supports up to Python 3.7).
Hello I´m trying to run a python manage.py runserver command but getting this error message
File "C:\Users\adrie\Anaconda3\lib\sre_compile.py", line 17, in
assert _sre.MAGIC == MAGIC, "SRE module mismatch"
AssertionError: SRE module mismatch
Does anyone have idea of what´s happening here?
I had anaconda installed previously and was running fine. But then I´ve deinstalled and reinstalled anaconda, and I´m getting this error now.
Make sure you do not have any mismatch between Python interpreter version used (like 3.7) and the 're' python module (like 3.6.1).
You need reinstall IDLE or anaconda
My PYTHONHOME and PYTHONPATH environment variables were pointing to the wrong version. By fixing this import sre_compile was fixed.
Make sure your installed python version matches exactly the version anaconda uses. If not get another python version.
On Windows you can see the anaconda python version in control center -> uninstall programm -> Name of Anaconda.
Also make sure there are no older python version installed (that still might have environmental variables that point to them).
You can switch your Python version of Anaconda. There should be no need to uninstall Anaconda.
Check for available Python versions:
conda search python
Choose your preferred Python version:
conda install python=3.7.5
I'm trying a Django tutorial. For some reason my existing superuser got deleted; creating that went fine, but I can't make another one. This also happens when I try to use pip.
I didn't change anything in the libraries so not sure why this happens now but didn't before. On windows 7 (Python 3.6.3 and Django 1.11). I've seen similar but not the exact same problems for Windows. Still I checked the file and there seems to be a PathLike class.
I've also tried to repair my Python installation but it didn't help. any ideas?
Seems like you may have modified the settings.py file. But as MrName mentioned you need to share full stack trace
This looks like a feature that changed in Python3.6 as you can see here. Make sure that your python version is 3.6 or greater.
Update your Python and Django version and that will work perfect.
AttributeError: module 'os' has no attribute 'PathLike'
Installing it into the global site-packages with the below command solved my problem:
pip install --user virtualenvwrapper
I have got a strange issue.
I am now using graphlab/numpy to develop a project via Pycharm 5. OS is Mac OS 10.11.5. I created a p2.7 virtual environment for the project. Programme runs well. But after I install ipython, I can no longer import graphlab and numpy correctly.
Error message:
AttributeError: 'module' object has no attribute 'core'
System keeps telling that attribute ‘core' and 'connect' are missing. But I am pretty sure that they can be found in graphlab/numpy folders, and no duplicates.
Project runs all right in terminal. Now I have to uninstall ipython. Then everything is ok again.
Please kindly help.
Please remember that console applications and GUI application do not share the same environment on OS X.
This also means that if you install a Python package from the console, this would probably not be visible to PyCharm.
Usually you need to install packages using PyCharm in order to be able to use them.
Upgrading pip itself then reinstalling worked for me
Super simple question: I went through the "getting start" doc for haystack (using whoosh; I installed both python-whoosh and haystack using pip (first time using it)), and I simply cannot run python manage.py rebuild_index. I get this error:
python manage.py rebuild_index
Unknown command: 'rebuild_index'
Type 'manage.py help' for usage
I do have 'haystack' listed in my INSTALLED_APPS in settings.py, so this solution doesn't seem to work for me. I also don't get import errors when I run "import haystack" so it does exist. I tried this on my existing project as well as a brand new object made just for this and I just can't get it to work.
However, when I import haystack after python manage.py shell and try haystack.__version__ I get "AttributeError: 'module' object has no attribute 'version'". I get a similar error if I try haystack.management: it has no management attribute.
It must be something super simple I'm missing. Thank you for reading this!
Did you perhaps install the wrong thing? This (embarrassingly) happend to me just today. Make sure you install 'django-haystack' and not just 'haystack' (and you will have to remove 'haystack', since it conflicts with 'django-haystack').
Do you have the path to haystack in your Python path? (Either the PYTHONPATH shell variable or the sys.path Python list.)
Did you run python manage.py syncdb?
Does python manage.py shell followed by import haystack work?
After import haystack, what do you get for haystack.__version__?
In the same shell, type the following. Do you get errors for any of them?
haystack.management.commands
haystack.management.commands.rebuild_index
haystack.management.commands.rebuild_index.Command.help
I had the same error that you did, and fixed it by removing the old .egg and installing directly from the latest version. You can use easy_install:
easy_install https://github.com/toastdriven/django-haystack/zipball/v1.2.4
Hope this helps!
I had the same problem - for whatever reason, the haystack version in pip is quite old and obsolete (v 0.6 as of today). To use django-haystack check out the v1. source.
It compiles and installs simply with
python setup.py build
python setup.py install
Hope that helps!
I just had the same problem and hadn't set HAYSTACK_SITECONF in my settings.py.
Instead of using python manage.py rebuild_index try using ./manage.py rebuild_index
just do
pip uninstall haystack and
pip install django-haystack