I recently just installed Inkscape to my Windows 10 computer, and it changed my python path.
C:\Users\Chinyere\Documents\Django Files\Commercial>python
Python 3.8.9 (default, Apr 13 2021, 15:54:59) [GCC 10.2.0 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.path)
['', 'C:\\Program Files\\Inkscape\\lib\\python38.zip', 'C:\\Program Files\\Inkscape\\lib\\python3.8', 'C:\\Program Files\\Inkscape\\lib\\python3.8\\lib-dynload', 'C:\\Program Files\\Inkscape\\lib\\python3.8\\site-packages']
I can't run my Django files. When I try, it pops-up error
C:\Users\Chinyere\Documents\Django Files\Commercial>python manage.py runserver
Traceback (most recent call last):
File "manage.py", line 10, in main
from django.core.management import execute_from_command_line
ModuleNotFoundError: No module named 'django'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 12, in main
raise ImportError(
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
Please, how can I change it to the default python path without uninstalling Inkscape.
First, you can try install the package again. If you can not install it again try to reinstall your python.
*Note: You should use virtual environment in python so it is easier to manage your library. After finished, you can note what library you use and install all the library by once.
py -m pip freeze
( Virtual Env: https://docs.python.org/3/tutorial/venv.html
Pip freeze : https://pip.pypa.io/en/stable/cli/pip_freeze/ )
Uninstall Inkscape and reinstall.
While reinstalling Inkscape, be sure to uncheck "add to path" if it is checked.
Related
This error has been haunting me. I have actually developed fixes and I document it and I successfully run the server on the below IP address. I try to reproduce my success after reinstalling the Ubuntu OS... with the same errors the same fixes won't do it anymore... now I need outside help. I have combed the internet for solutions. I try to add django to the PYTHONPATH and it IS added but when I exit the python interpreter the appended django path disappears!
Another item of detail that may help is that my website www.doman.com/admin is directed to the django admin login screen. I tried to log in using username and password but it fails which makes me think django is not working properly.
$ sudo python3 manage.py runserver 192.165.4.3:80
I get the error:
Traceback (most recent call last):
File "manage.py", line 8, in <module>
from django.core.management import execute_from_command_line
ModuleNotFoundError: No module named 'django'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 14, in <module>
) from exc
ImportError: Couldn't import Django. Are you sure it's installed and
available on your PYTHONPATH environment variable? Did you forget to
activate a virtual environment?
Django is installed within my environment:
$ django-admin --version
2.0.6
Python path attempt:
$ PYTHONPATH=/home/kap/dev_env/lib/python3.6/site-packages/django python
Python 3.6.5 (default, Apr 1 2018, 05:46:30)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> sys.path
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'sys' is not defined
>>> import sys
>>> sys.path
['', '/home/kap/dev_env/lib/python3.6/site-packages/django', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/home/kap/dev_env/lib/python3.6/site-packages']
>>> quit()
Immediately confirm django is added but it disappeared:
$ python3
Python 3.6.5 (default, Apr 1 2018, 05:46:30)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/home/kap/dev_env/lib/python3.6/site-packages']
sudo bypasses your virtual-environment it runs as a root user and django is not installed in root account. That is why it is throwing error .you can run without sudo or you can install django in your root account by
sudo python3 -m pip install django
Try this:
sudo python3 -m pip install django
Or if you have a requirements.txt
sudo python3 -m pip install -r requirements.txt
It is better to manage port 80 by nginx.
I actually solved it before anyone posted:
`pip install django`
is what I used. More specifically I used 'pip install django psycopg2 and gunicorn' since installing all three together seemed to fix another issue. I was using pip3 instead of pip. There are so many 'sensitivities' so that the order of installation, specific flags and package versions of installations can break or make the whole thing. I'm thinking of making a tutorial of the whole thing and putting a video online. Maybe I can set a link on this page.
Consider pipenv - git repo is here, with more information. Better control of packages, ease of deployment, and better control of virtual environments.
For some reason I'm getting this error when trying to import gevent inside my docker container:
# python
Python 2.7.10 (default, Oct 14 2015, 16:09:02)
[GCC 5.2.1 20151010] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gevent
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/gevent/__init__.py", line 51, in <module>
from gevent.hub import get_hub, iwait, wait
File "/usr/local/lib/python2.7/dist-packages/gevent/hub.py", line 31, in <module>
from gevent._util import _NONE
ImportError: cannot import name _NONE
>>>
Which is odd because _util.py exists, it's in the dist-packages/gevent directory. When I did a pip install on another system, it works fine.
Anyone have any ideas what might be going on?
Have you upgraded gevent package recently or maybe installed it over old version?
I ran pip install --ignore-installed gevent to update old version of this package in my virtualenv, and then this error starts to appear.
I fixed it with pip uninstall gevent (two times to completely remove it) followed by pip install gevent.
I think you import gevnet this module is not you see it.
you can print something in you _util.py module.
if nothing print, I guess "/usr/local/lib/python2.7/dist-packages/gevent/hub.py" import _util is not in /usr/local/lib/python2.7/dist-packages/gevnet, and you can try to print sys.path to find real import path and fix it.
In my Method:
uninstall gevent.
use a another system gevnet or virtualenv package,and copy to you real(I guess you have a env path like '/usr/local/lib64')
exec python -c 'import gevent' test is ok.
I have tried dulwich, and GitPython - neither of which seem mature. Now I am trying to install libgit2/pygit2. I have successfully installed them into the host packages environment, but now I need to get them installed in the virtualenv of the app I am building.
Python 2.7.3 (default, Sep 26 2013, 20:03:06)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygit2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/pygit2/__init__.py", line 32, in <module>
import _pygit2
ImportError: libgit2.so.0: cannot open shared object file: No such file or directory
>>>
As you can see the current issue seems to be that the globally installed libgit2.so.0 cannot be found from within the virtualenv. Fair enough, that is what virtualenv is about after all,, sandboxing. So how do I go about linking/symlinking/building a version/copy of the libgit2.so for the virtualenv ?
I found the following script in a Gist that - when run while logged into a virtualenv -- will install the current libgit2/pygit2 together there in the venv.
https://gist.github.com/olivier-m/5755638
One note of caution, update the version numbers for both libraries to the same most recent version ( 0.20.0 at this time of writing ).
I followed the instructions here...
https://github.com/ahupp/python-magic#dependencies
I ran pip install python-magic and it installed without any issues. Then I installed cygwin and added C:\cygwin\bin to my system path. When I run the python interpreter in a Windows command prompt and import magic I get this error...
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import magic
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\magic.py", line 161, in <module>
raise ImportError('failed to find libmagic. Check your installation')
ImportError: failed to find libmagic. Check your installation
>>>
Did I miss a step?
The python-magic use libmagic,
The libmagic needs magic1.dll,
That magic1.dll is in the file package of gnuwin32.
Solution 1:
Download binaries zip or setup package of file, and adding path of bin directory of it to PATH environment variable.
Solution 2:
Also there is a new change-set in code of python-magic that fixed the problem and you don't need to file package of gnuwin32 (just add bin directory of cygwin to PATH), but currently there is not yet in magic.py while you install it with pip install python-magic or by pip install python-magic --upgrade,
So you need to install python-magic from master.
Also have a look at this post: http://www.thehackeruniversity.com/2014/02/02/obtain-python-mime-types-windows/
This guy uses Hachoir to find the mime info for binary files.
After installing Mac OS 10.9 (Mavericks) the Django version is no longer installed or apparently the system can't find the right paths to make it runs. How can I repair this?
This are the errors I'm getting trying to run Django:
Python 2.7.5 (default, Aug 25 2013, 00:04:04)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named django
>>>
$ python manage.py
Traceback (most recent call last):
File "manage.py", line 8, in <module>
from django.core.management import execute_from_command_line
ImportError: No module named django.core.management
Did you install Django into your main Python directory? If so, the version of Python might have been upgraded. This might have wiped your central site-packages. If, so, just reinstall Django.
Alternatively, and more advisable, use virtualenv. This will create a separate Python environment (including site-packages for each project), preventing this (probably) from happening again in future.
Install VirtualEnv Systemwide then setup virtual env
Installing
sudo easy_install virtualenv
now create project folder and cd into that after that
virtualenv venv
. venv/bin/activate
then install django using pip
pip install django