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.
Related
I already fixed this, but I will post the question anyways and answer it so if there are other people having this issue they may find this.
I installed blender a while ago and did some stuff using python. I can't recall what exactly I did, it was for a school project. However, when I recently tried to use pip to install something I got the following message:
Error in launcher: Unable to create process when using "path to python my blender folder"
Even if you get this answer due to another situation my solution might still help you.
This worked for me:
First I uninstalled Blender.
Then I uninstalled python and reinstalled the newest version.
I deleted every environment variable path I could find leading to an old python version.
In the Terminal I entered where pip and still got some paths leading to old python versions, I went to these locations and deleted every folder labeled with an old python version, in my case these locations were C:\Python37and C:\Users\myusername\Appdata\Roaming\Python
And that's it. After that pip worked as it should.
let me mention first that I just started to learn Django and it seems like I am already failing by setting it up.
I went to the steps recommended on the 'First steps in Django' page, even bought the book 'mastering Django' and I am also aware that this question has probably be answered already but so far I couldn't find a solution according to my problem.
So what happens is basically that I installed pip, I installed virtualenv and Django. When I try to create a virtualenv I get the following error message:
M-MacBook-Air:django m$ virtualenv first
Using base prefix '/Users/m/anaconda'
New python executable in /Users/m/Desktop/python/django/first/bin/python
dyld: Library not loaded: #loader_path/../lib/libpython3.5m.dylib
Referenced from: /Users/m/Desktop/python/django/first/bin/python
Reason: image not found
ERROR: The executable /Users/m/Desktop/python/django/first/bin/python is not functioning
ERROR: It thinks sys.prefix is '/Users/m/Desktop/python/django' (should be '/Users/m/Desktop/python/django/first')
ERROR: virtualenv is not compatible with this system or executable
According to the scripts, tutorials etc. I should find the following folder in my new created
virtualenv:
\Include
\Lib
\Scripts
\src
but in my case it's just
virtualenv:
\bin
\include
\lib
The obvious question: why is that? I use Python3.5, pip9.0.1 and virtualenv15.1.0. I start Python via Anaconda, downloaded Homebew once but deleted it and also the attempt to delete pip, virtualenv and Django and start all over again didn't really work.
Not sure if those information are enough to help. I appreciate any kind of advice. This drives me nuts, thanks a lot!
I'm having a problem with this package that I installed in Python 3.5. After installing it, I try to run requestProxy.py but it won't import any of its own packages. Here's what I did, and what's happening.
I cloned it and created a private repo using these instructions.
I installed in an activated virtualenv, created without using sudo, using:
pip3 install -e HTTP_Proxy_Randomizer
Terminal said it installed ok.
I can find the egg link in my virtualenv's site-packages folder, but when I try to run the main file, it says:
from project.http.requests.parsers.freeproxyParser import freeproxyParser
ImportError: No module named project.http.requests.parsers.freeproxyParser
I had to write a setup.py for the package, which didn't seem to come with its own. I came up with:
setup(name='HTTP_Request_Randomizer',
version='1.0',
description='HTTP Proxy Request Randomizer',
package_dir={'project': 'project','http':'project/http',\
'requests':'project/http/requests','errors':'project/http/requests/errors',\
'parsers':'project/http/requests/parsers','proxy':'project/http/requests/proxy'},
packages=['project','http','requests','errors','parsers','proxy']
Here's the package structure:
pip3 freeze
gives me:
Complete output from command git config --get-regexp remote\..*\.url:
fatal: bad config file line 4 in /home/danny/.gitconfig
----------------------------------------
Error when trying to get requirement for VCS system Command "git config --get-regexp remote\..*\.url" failed with error code 128 in /home/danny/Documents/HTTP_Request_Randomizer, falling back to uneditable format
Could not determine repository location of /home/danny/Documents/HTTP_Request_Randomizer
Django==1.9.7
## !! Could not determine repository location
HTTP-Request-Randomizer==1.0
mysqlclient==1.3.7
So I want to have requestProxy.py install the other necessary packages and not fail at line 1. I'm sure this is a problem with my implementation and not the original author's coding. I was experimenting with this package a couple of weeks ago before I was aware of virtualenvs or pip install -e, and just copied it manually to site-packages. It worked then. Now I understand the concepts to do it more cleanly, but I can't get those to work.
It feels as though I have done something wrong with my git config or with my package_dir structure in setup.py, perhaps?
I've been pythoning for maybe a month and have a lot to learn. I normally find what I need on Stack Overflow without having to bother anyone, but after trying everything with this, I really need some help. Any advice much appreciated.
I figured it out. I was using Ninja IDE, and even though I entered the virtualenv for the project and restarted, it still wasn't recognizing it. I was able to run it from the terminal, and also in Pycharm and Liclipse.
Trying to install a Python module called Dislin. Unfortunately I haven't had success setting the environment for Dislin, and I will get an install error. The instructions for setting the path are below, but they are a bit obscure to me. Can anyone make it a bit more explicit? (I'm learning).
d) Choose a directory in the file structure where DISLIN should be
installed and define the environment variable DISLIN with it:
For example: export DISLIN/$HOME/dislin
ftp://ftp.gwdg.de/pub/grafik/dislin/darwin/README.DARWIN
My site packages for python 2.7 are here: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages. I would assume I need to point Dislin home here, but so far have not been successful, as I am probably doing it wrong, but I get an error like: export: `DISLIN/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dislin': not a valid identifier
If you've already installed dislin, what you have to do is make sure that wherever you've installed the data for dislin (not for Python), is on your system environmental variable PYTHONPATH. This is pointed out in #5 in the ftp link you posted.
What you would do, if dislin can be found on your computer at the path you posted above, is add the following to your PYTHONPATH:
DISLIN/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dislin
I'm trying to install python to a 1and1.com shared linux hosting account.
There is a nice guide at this address:
http://www.jacksinner.com/wordpress/?p=3
However I get stuck at step 6 which is: "make install". The error I get is as follows:
(uiserver):u58399657:~/bin/python > make install
Creating directory /~/bin/python/bin
/usr/bin/install: cannot create directory `/~’: Permission denied
Creating directory /~/bin/python/lib
/usr/bin/install: cannot create directory `/~’: Permission denied
make: *** [altbininstall] Error 1
I look forward to some suggestions.
UPDATE:
Here is an alternative version of the configure step to fix the above error, however this time I'm getting a different error:
(uiserver):u58399657:~ > cd Python-2.6.3
(uiserver):u58399657:~/Python-2.6.3 > ./configure -prefix=~/bin/python
configure: error: expected an absolute directory name for --prefix: ~/bin/python
(uiserver):u58399657:~/Python-2.6.3 >
The short version is, it looks like you've set the prefix to /~/bin/python instead of simply ~/bin/python. This is typically done with a --prefix=path argument to configure or some other similar script. Try fixing this and it should then work. I'd suggest actual commands, but it's been a while (hence my request to see what you've been typing.)
Because of the above mistake, it is trying to install to a subdirectory called ~ of the root directory (/), instead of your home directory (~).
EDIT: Looking at the linked tutorial, this step is incorrect:
./configure --prefix=/~/bin/python
It should instead read:
./configure --prefix=~/bin/python
Note, this is addressed in the very first comment to that post.
EDIT 2: It seems that whatever shell you are using isn't expanding the path properly. Try this instead:
./configure --prefix=$HOME/bin/python
Failing even that, run echo $HOME and substitute that for $HOME above. It should look something like --prefix=/home/mscharley/bin/python
You really should consider using the AS binary package from Activestate for this kind of thing. Download the .tar.gz file, unpack it, change to the python directory and run the install shell script. This installs a completely standalone version of python without touching any of the system stuff. You don't need root permissions and you don't need to mess around with make.
Of course, maybe you are a C/C++ developer, make is a familiar tool and you are experienced at building packages from source. But if any of those is not true then it is worth your while to try out the Activestate AS binary package.
I was facing same issue with 1and1 shared hosting (Your provided linked tutorial is not available now). I followed Installing Python modules on Hostgator shared hosting using VirtualEnv tutorial with only one change for 1and1. That is:
Instead of:
> python virtualenv-1.11.6/virtualenv.py /home1/yourusername/public_html/yourdomain.com/env --no-site-package
I used:
> python virtualenv-1.11.6/virtualenv.py /kunden/homepages/29/yourusername/htdocs/env --no-site-package
Rest of the instructions worked and I successfully installed VirtualEnv.
Example: 1and1 does not provide Requests module and pip cannot be used in shared hosting. This screenshot demonstrates that after installing VirtualEnv, pip command can be used and at the end >>> import requests successfully worked.