I've just started looking into python and django.. Im pretty sure ive successfull installed both python and the django framework and i managed to add python and django-admin.py to my system path but now when i run the command django-admin.py startproject My_Test_Site, in the folder i want to create a new project directory in (just following the tutorials), i get the following error:
What am i doing wrong?
This is not a Django error. It appears it cannot find the Python module unicodedata which is part of the Python Standard Library (docs). I see that there is also a bug report about this issue (Python 2.7 on Windows, see here). On the other hand, some people there report that reinstalling their Python installation fixed the problem. You could give that a try.
notice the last line, it says import unicodedata, importError
im guessing you probably didnt install your django properly.
so reinstall it and check that django is in your "path", i believe django does this automatically when it installs but doesnt hurt to double check.
if reinstalling django still doesn't work, i suggest you uninstall python and django related stuff.
then install python, install pip, then use pip install django.
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).
The command 'import torch' causes the build error: 'ModuleNotFoundError: No module named 'torch''.
But when I run the command in the terminal, pytorch works just fine (Python 3.7.X).
Are you using a venvin the project you are right now? If that is so, then you need to install torch in that venv, as it has been created just for the project, so it has not got any extra modules like that one.
Take a look at this. And make sure that the module is in the environment your project is!
In Pycharm for example, whenever you create a new project with a new venv(virtual environment), you need to add to your project settings->interpreter settings the module manually, so it can be imported. Because it may be installed in your system, but not in that venvspecifically, which will look in there!
try this
link
it might help.
Also Faced similar issue in Windows 10 with Anaconda installed. Installed pytorch package using conda install command which I found here: http://pytorch.org/
The usual import from command-line worked for my environment(torch):
I am currently setting up Django on my Windows 10 system and after having installed it successfully, I am now facing an error message when trying to start a new Django project.
I have created a new directory for my project, gone to the command line and changed the directory to this new folder path and then typed the command:
django-admin.py startproject mysite
but I get a pop up window with the error message:
"Still can't get my hands on win32ui"
As I understand it, win32ui is a module contained within pywin32 - so I have gone and checked that pywin32 is correctly installed on my laptop - which it is as:
pip install pywin32
results in:
Requirement already satisfied (use --upgrade to upgrade): pywin32 in c:\python27\lib\site-packages
I've searched Google and StackOverflow but there isn't a single hit for this error message in relation to new Django projects.
Could anyone shed some light on how I can successfully get a new Django project set up?
According to here, to install pywin32 system files, run python.exe Scripts\pywin32_postinstall.py -install from an elevated command prompt.
For example, this works for me: "C:\Programs\Python\Python3\CPython\x64\Python35\python.exe" "C:\Programs\Python\Python3\CPython\x64\Python35\Scripts\pywin32_postinstall.py" -install.
It looks like Python can't properly locate the libraries you're trying to import. Doing a clean python install may solve the issue. However, instead of doing that, you could try the following:
I've seen this problem happen before when a python installation failed to copy pywintypes27.dll and pythoncom27.dll to the win32 folder, please try doing this:
Go to C:\Python27\Lib\site-packages\pywin32_system32
Copy pywintypes27.dll and pythoncom27.dll
Paste them in C:\Python27\Lib\site-packages\win32
For future reference, if this works, how did you install Python?
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
Upon trying to start a Pinax app, I receive the following error:
Error: No module named notification
Below are the steps I took
svn co http://svn.pinaxproject.com/pinax/trunk/ pinax
cd pinax/pinax/projects/basic_project
./manage.py syncdb
Any suggestions?
UPDATE:
Turns out there are some bugs in the SVN version. Downloading the latest release solved my problem. If any one has any other suggestions on getting the trunk working, they would still be appreciated.
I'd avoid the svn version all together. It's unmaintained and out of date. Instead, use the git version at http://github.com/pinax/pinax or (even better) the recently release 0.7b3 downloadable from http://pinaxproject.com
Two thoughts:
1. Check all of your imports to make sure that notification is getting into the namespace.
2. You may be missing quotes around an import path (eg. in your urls.py: (r'^test', 'mysite.notification') -- sometimes I forget the quotes around the view)
Try following the latest install instructions here:
http://github.com/pinax/pinax/blob/600d6c5ca0b45814bdc73b1264d28bb66c661ac8/INSTALL
Don't think this will work on Windows (maybe if you are using cygwin) as they are using virtualenv and pip.
Note the version has recently been upgraded to 0.7rc1
IIRC I had to add a directory or two to the Python path last time I did a fresh install of Pinax. I'm doing a fresh checkout now into a new virtualenv, I'll edit this answer if I hit any snags.