Virtualenv on remote machine gives command not found, even after path reset. - python

First, background: I'm an undergraduate student in physics and mathematics. I have experience programming in Python, and I've gained a lot of experience with using various shell programs while trying to solve this problem.
I'm needing to run some software on a cluster at my University. I'm trying to do this by running ssh from my mac to the machine. I've been having a lot of trouble installing packages because of permissions, so I thought I would try using virtualenv.
Despite the fact that other packages would not install, virtualenv seemed to install. However, when I try to run it, I get
virtualenv: Command not found.
In trying to solve my problem, I tried reinstalling it and got
Requirement already satisfied: virtualenv in ./.local/lib/python3.4/site-packages.
I though maybe the issue was that my path was not set right. The remote machine is using tcsh, and so I ran
setenv PATH ${PATH}/local/local/lib/python3.4/site-packages
and the path now is:
/usr/local/texlive/2017/bin/sparc-solaris-10:/local/bin:/usr/plocal/bin:/usr/local/bin/X11:
/usr/local/bin:/usr/local/share/bin:
/usr/openwin/bin:/usr/dt/bin:/usr/bin/X11:
/usr/X11/bin:/usr/local/pbmplus:/usr/local/X11R5/bin:/usr/local/plot79:/usr/java/bin:
/usr/local/java/bin:
/usr/local/hotjava/bin:/opt/SUNWspro/bin:
/usr/ccs/bin:/usr/ucb:/usr/sbin:/usr/bin:/bin:/sbin:/usr/5bin:
/usr/local/etc:/etc:/usr/plocal/sun/bin:./local/local/lib/python3.4/site-packages
Yet, it remains that if I try to run virtualenv, it claims that the command is not found!
FULL DISCLOSURE: This question is similar to the following question listed here. But, the solution there won't work for me because I can't use sudo:
sudo: unable to stat /etc/sudoers: Bad file number
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
Segmentation fault
As another note, I have emailed the guy in charge of all the Unix stuff to help me with, as have my advising professors, and he has done nothing. If at all possible, it would be best if there were a way to do this that did not involve me needing to get permissions from him.

Having virtualenv in .local/lib/python3.4/site-packages means that you've installed it only for you using --user option; hence the scripts are in ~/.local/bin. So do
setenv PATH ${PATH}:$HOME/.local/bin

Related

pip install error: Please check proxy URL. It is malformed and could be missing the host - but I'm NOT behind a proxy

Please consider not to flag this question as duplicate since it differs from the problem and solutions given in all these:
Error installing with pip - Please check proxy URL. It is malformed and could be missing the host
Please check proxy URL. It is malformed and could be missing the host
Error during pip install -Please check proxy URL
The thing is that I recently installed Python 3.9.2 x64 on Windows 10, and I tried to use this command:
python.exe -m pip install -U "telegram-upload"
And I get this error message:
ERROR: Could not install packages due to an EnvironmentError: Please
check proxy URL. It is malformed and could be missing the host.
But I'm NOT using a proxy. So it is a strange error for me, I don't understand why I get this error message.
How can I pass through this error in order to install the package I need with PIP?.
I finally solved it by creating a new environment variable with name "NO_PROXY":
SETX /S "%COMPUTERNAME%" /U "USERNAME%" "NO_PROXY" "0"
(it seems the value is irrelevant, maybe pip only checks for the existence of this variable name)
Just by reading and trying random things from the docs: https://pip.pypa.io/en/stable/user_guide/
And this issue on their GitHub repo: https://github.com/pypa/pip/issues/2440
My question now is: how is supposed a Windows user or a beginner python user would figure out all this????.
I mean, I don't think that this problem only occurs to me, because I just did a fresh Python install on a fresh Windows 10 O.S with a home network with no proxy no vpn not anything strange, and on this fresh scenario I had no way to install a package using pip because it falsely detected me behind a proxy when I'm really not... so why Python devs team provide a Python installer for Windows if it does not try to figure network settings to avoid weird errors and to make the end-user experience good, clear and easier?.
If a proxy or no_proxy environment variable must be specified always in order to use pip correctly then the Python installer should at least advise about it since installing modules is one of the most common things a programmer will do when using python. I'm very dissappointed with all the time and effort that Python wasted my time just for having a weird, false positive error in the very basic and very early usage of this programming language.
Things should be clear and automated by the Python installer, not expecting that the beginner user to go to the pip docs to figure out how to solve unexpected errors in their very first usage.
Anyways, problem solved, now I can install any package having set the NO_PROXY environment variable.

Anaconda install, basic usage issues

everyone. I installed anaconda to use python and install ai packages. I am new to high-level computer use beyond the normal GUI that windows has blessed us with.
Background: I am just starting using command prompts and am teaching myself python to use for ai with keras and tensorflow. Unfortunately, I cannot get far enough to install these packages because after I install anaconda, I get multiple errors in the command prompt. Access Denied was solved by installing for all users and running as administrator. However, I cannot use conda, and when I use pip, I get constant html errors. Nothing works. I tried adding \Anaconda3 and \Anaconda3\Scripts to PATH, but it doesn't change anything. The prompt starts by telling me that it cannot find the specified paths then kicks me over to C:\Windows\system32, but when I cd back to my \Anaconda3 directory, nothing changes. What am I doing wrong? What do I need to try?
I appreciate it. As basic as this is, rest assured I spent days struggling with this before posting.

Cannot install via pip within virtualenv

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.

Problems building node.js on Cygwin, please help

I'm trying to get node.js running on Windows 7. I have no experience with Linux so I've just been blindly following instructions from tutorials I've found, but I'm still unable to build node.js.
What I did:
Install Cygwin - the entirety
Attempt to build node.js
This is the error I first got:
I then followed the commands of two other similar sites and they all resulted in this error (could getting several version of node have caused me more problems? I'm completely clueless on this).
I read somewhere that the Windows version of Python could be causing the problem so I uninstalled my Python 2.7 and added C:\cygwin\bin to the PATH.
That still didn't work and I read somewhere else that I'm supposed to rebaseall so I tried that, but I also got an error for that:
That's where I'm at now. Have any steps I've taken exacerbated the situation?
Add -e '/\/sys-root\/mingw\/bin/d' at line 110 in /bin/rebaseall file.
Then re-run rebaseall -v and you shouldn't get the error anymore.
See this pretty helpful blog posting - Node on CygWin doesn't work for Node v0.2.5. Use the latest v0.4.0 version instead.
Also consider the post's recommendation of compiling against MinGW instead of in CygWin.
First of all, why did you check out such an old release v0.2.5? When I did it a few weeks ago I just took the latest and ended up with 0.5.0pre, but it would also be reasonable to specify v0.4.3. For instance, type git clone git://github.com/joyent/node.git to download node, and then:
cd node
./configure
make install
Secondly, do not rebase by running ash from the CYGWIN shell. Instead, shutdown all Cygwin processes, then use Windows explorer to open the ash.exe binary. Since I have a Windows 7 system without node.js, I decided to follow my instructions and build. Not so easy. I ran into some wierd dll issues that all went away when I ran ./rebaseall followed by ./perlrebase from the ash prompt. It seems that rebaseall is not sufficient anymore.
Thirdly, there is a message that makes it sound like you don't have a C compiler. Some googling will lead you to sites telling which Cygwin packages you need, but at minimum install the g++ compiler and that should pull in C as a dependency.
When I did this I simply ran configure and every time there was an error, installed one more Cygwin package to supply the missing piece. Even OpenSSL is available.
What I just found is remove the windows based install of Python. After uninstalling this, everything is peachy.
I like cygwin a lot -- but recent releases have become pretty unreliable. Some packages just wont build, and some "standard" apps dont work e.g. gvim's "save as" bombs out on my installation.
A possible solution would be run one of the better Linux distributions (ubuntu, fedora, suse etc.) either as a virtual machine or a dual boot setup and do the build inside linux.

Installing python on 1and1 shared hosting

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.

Categories

Resources