EDIT #2: Solved! 7 hours spent because of a default read-only permission. See answer below!
Windows 8 machine, Django 1.6.5, Python 2.7.8
So I set Django up earlier on a VPN (trying to learn to code from China is tough) and everything worked well. However, this time I tried it, I got this error:
ImportError: No module named django.core
Here's a picture of it in full:
Here's what I've done so far after looking at other StackOverflow threads -
Checked to make sure there is only one version of Python (2.7.8)
Made sure I activated the virtualenv (you can see it in the image above)
Un/reinstalled python anyways
Reinstalled django in this virtualen
Set up a different virtualenv to no avail
Recreated virtualenv from scratch
Double checked my environmental variable PATH was set to:
C:\Windows\System32;C:\Python27;C:\Python27\python.exe;C:\Python27\Scripts\;C:\Python27\Lib\site-packages\django\bin;
(this is because I'm following this tutorial: http://codingforentrepreneurs.com/projects/launch-with-code/start-project/)
Removed #!/usr/bin/env python from both manage.py; didn't work, so put it back in
EDIT:
- Turned off "Read-only" permissions of Lib\site-packages\django where the django-admin.py file is located
Should have searched on stackoverflow instead of Bing/Google. Found a few other related questions/answers but am confused about:
- $PYTHONPATH, my video guide doesn't mention this at all so I have no idea where to start (https://stackoverflow.com/a/6059969/4194756 and http://blog.jayteebee.org/2009/07/importerror-no-module-named-djangocore.html)
- When I tried this way to use the "correct" python,
ftype Python.File="E:\Python27\YOUR_ENVIRONMENT\Scripts\python.exe" "%1" %*
It gave me an error message:
Access is denied. Error occurred while processing: Python.File
I've still got a problem though as you can see in the image.
Found a link here: http://samudranb.com/2012/06/02/how-to-setup-a-djangopython-development-env-on-windows/
Check the folder permissions of the “django” folder inside “YOUR_ENVIRONMENT\Lib\site-packages“. Remove any read-only permission settings.
There was a default read-only permissions setting on the folder mentioned and after disabling it, everything's working again! Woo time to get out of a sketchy KFC and get some sleep. Thanks everyone!
Also, shout out to #aruisdante who mentioned in the comments that it could be a permissions error. Didn't know where to go from there being inexperienced but glad it worked out!
Related
I want to run JdeRobot drone_cat_mouse on my Ubuntu 20.04. I'm using ROS Noetic and has faithfully followed these installation instructions. Everything it told me to test was working properly.
When I first ran roslaunch drone_cat_mouse.launch, there was an import error for teleopWidget and sensorsWidget which I fixed by using relative imports. Then I had an error No module named qfi.
Unlike teleopWidget and sensorsWidget, I couldn't find the qfi module in the JdeRobot/drones source code. So I googled it, and the only relevant result that popped up was this, which led to this link. They said to:
sudo touch /usr/lib/python2.7/dist-packages/qfi/__init__.py
But I ran that command and this happened!
Not even pip has a "qfi" module!
So I thought to check JdeRobot's entire repository. Turns out it was in JdeRobot/base, and that repo is not maintained anymore!
After further digging, there was this issue which basically tells us forget about it and move to the web release! But I can't, circumstances forced me to use the source code option (deliverables are drone_cat_mouse.world and my_solution.py, it's impossible for me to get the former in the docker web version and the latter's format is different between the source code version and the web version).
In a nutshell, how do I fix this qfi module problem so that I can run the exercises from source like these people?
I'm just stupid, as usual. all I need to do was clone https://github.com/JdeRobot/ThirdParty, get the qfi module, copy it to
~/catkin_ws/src/drones/rqt_drone_teleop/src/rqt_vel_teleop/ and replace all qfi imports with its relative import version. All common sense
No errors in terminal, gazebo runs, but somehow the rqt widget for drone vision never appears.
Forget it, I'm giving up on this dumpster fire of a program.
Edit: I did another fresh install, followed the steps, noticed troubleshooting for qfi which required qmake, but same end result
If you're trying to launch drone_cat_mouse there is an issue with the namespace of the RQT widget that occurs when you try to launch it.
Namely, the topics that exist for drone_cat_mouse are prefixed by cat/ or mouse/. But RQT will try to access these topics without the prefix and run into an error. Alternatively, since you have a local install, you can try to run the code manually by running
python my_solution.py
Just make sure the change the area where the DroneWrapper class was called in the following manner:
HAL = DroneWrapper('drone', 'cat/')
Here 'drone' is the name of the node you are creating and 'cat/' is the namespace given to the DroneWrapper Class.
I am having problems with setting environment variables in Windows 10. I'm not sure where I'm going wrong. Also in case anyone asks, I am using the latest version of Python.
I pulled the code from this github to test out the project.
Whenever I try to run a .py file in the nitro project that imports the nitf module on the cmd like so python [any .py file name].py , I get a Module Not found error stating that the nitf module does not exist.
In order to solve this problem, I checked the issues page where someone had a problem similar to mine. The page emphasized setting up environment variables to fix the issue.
This is how I have set up the NITF_PLUGIN_PATH, the PYTHONPATH, and the System Variable Path according to this youtube video I found online. (Images are below, the red blocks out my name):
The error I keep getting with the module
The path I added for the NITF_PLUGIN_PATH as per issues page
The path I added for PYTHONPATH as per video
The path I added for System Variable Path as per video
But even after I set the variables, and restarting the cmd, I keep seeing that the nitf module does not exist. I've tried multiple different pathways for the variables, but those don't work either. Now I'm at a loss. Any advice on what to do, or where I'm going wrong?
I have switched from PyCharm to VSCode for Django development. I cannot get rid of the pylint "Unable to import XXXXX pylint(import-error)" errors for my development modules that are not packaged into my venv.
I have gone through about 20+ discussions from google, most of which are stackoverflow. I have tried all the suggestions and think I now know what the problem is - or at least what the workable solution is.
My setup is as follows. I have a venv where I have pip installed various packages. This is what I use for development work with 2 projects. This works fine and VSCode can see it and use it.
My library code sits in a VSCode project and this can be seen and used from my web project because of:
{
"python.pythonPath": "/home/XXXXX/.virtualenvs/YYYYY/bin/python",
"python.autoComplete.extraPaths": [
"/home/XXXXX/dev/VisualStudioCode/repositories/my-library"
]
}
So far so good. But after trying all the suggestions for pylint to find this code, I have come to the conclusion that pylint requires my library to be installed in the venv and I don't want to do that while I am still developing. So basically, all my code works fine and pylint works fine for intellisense and debugging. BUT I have to put up with these pylint errors when I have particular files open. Luckily, when I close the relevant file, the pylint error disappears from the problems list in the VSCode terminal.
Has anybody else reached the same working conclusion?
I found the answer after more google trawling. It's actually in this [PyLint "Unable to import" error - how to set PYTHONPATH? stackoverflow post.
I created the file .pylintrc in my home user folder, and added the lines :
[MASTER]
init-hook='import sys; sys.path.append("/home/XXXXX/dev/VisualStudioCode/repositories/my-library")
to this file. PyLint now finds my library code from my website project.
Thanks to Brian M. Hunt, June 2017.
so I tried to set up an working environment to code some stuff with python. I used this really nice website newcoder.io to do it the right way.
Unfortunately I came across a big problem I cannot solve by myself even after several hours of trial and error (sponsored by Google).
I installed all required packages starting from python, virtualenv, virtualenvwrapper. I also changed the .bashprofile for using Terminal as stated. Then I tried to test the working environment like described in the aforementioned website newcoder.io Test.
As I was within the working environment named "TestEnv" I tried to install django via pip. Here is the result coming from Terminal:
(TestEnv)username:~ username$ pip install django
-bash: /Users/username/.virtualenvs/TestEnv/bin/pip: "/Users/brokenusername: bad interpreter: No such file or directory
As you can see there seems to be something wrong with the underlying links. I have to admit, that I recently changed my account name and the name of the home directory in OS X Mavericks (see "username" and "brokenusername" within the code). Everything went fine so far. The username is now without blank spaces in the name (a different, bigger problem, but solved). But pip still seems to keep the old "brokenusername".
My Question is, how do I change the "brokenusername" to "username" so that pip is able to its work.
Thanks for all advices.
Here is a sloth for all your efforts to help !
Please note: I am newbie when it comes to understand and change these kind of working environments. I tried my best to find a solution by myself. But it seems like I need some advice from the Internetz.
virtualenv creates symlinks, environment variables and other path links in places like .pth files that are invalidated when you change the base path of the env. But environments are cheap to create so (assuming you haven't placed other files in the virtualenv directory) just delete it and build it again.
I was trying out the HTML5 Game Engine Turbulenz, which requires Python to be installed on the machine. I downloaded and installed Python, and then I downloaded the installer for Turbulenz. In the middle of the installation, I get an error that says "Cannot find python.dll". After clicking ok, the installation continued, so I thought it was fine. When I tried to start Turbulenz, I got a new error, saying "env/Scripts/activate.bat" is missing. I Googled the error and found nothing relevant. I remembered the first error, and I went looking for python.dll. Turns out that it is in C:Python27/, where my Python installation is. Can anyone explain what is going on?
my honest guess is that you need to make sure that C:\Python27 is set up in your PATH variable. There's a video link on the official python docs that helps you get there
http://showmedo.com/videotutorials/video?name=960000&fromSeriesID=96
or other StackOverflow answers
How do I run a python program in the Command Prompt in Windows 7?
once your python folder is added to the path, you should have no problem