Unable to install sftp package in python on my virtual machine - python

I need to use sftp services through python on my virtual machine.
To note that I am unable to do commands like
pip install packagename
I have limitations on the controlled VM. So I have to download packages and point to local disk locations (pip install C:/Folder/packacgename.whl) to install them so please give me suggestions keeping this in mind.
Trying to install
pip install C:\Windows\pysftp-0.2.9.tar.gz
I needed bycrypt. And trying to install that it said No matching distribution found for setuptools>=40.8.0
I downloaded setuptools and did
pip install C:\Windows\setuptools-59.2.0.tar.gz
I get message
Missing build time requirements in pyproject.toml for file:///C:/Windows/setuptools-59.2.0.tar.gz: 'setuptools' and 'wheel'.
This version of pip does not implement PEP 517 so it cannot build a wheel without 'setuptools' and 'wheel'.
Installing build dependencies ... error
Complete output from command z:\scripts\python.exe -m pip install --ignore-installed --no-user --prefix C:\Users\AppData\Local\Temp\pip-build-env-jmi2p:
ERROR: You must give at least one requirement to install (see "pip help install")
I tried doing
C:\scripts\python.exe -m pip install --upgrade pip
This failed with message pip already up to date
I checked pip version
pip --version
pip 10.0.1 from z:\lib\site-packages\pip (python 3.7)
Manually trying to upgrade pip with tar file I get message setup tools need upgrade
pip install --upgrade C:\Windows\pip-21.3.1.tar.gz
I used --no-binary :all: , this didn’t work.
I have downloaded Microsoft 2015 build tools and installed them as advised by some forum. It didn’t work. I don't really know how to fix this issue. Trying to download PEP517 tar file and installing that does not work as it wants pip to be upgraded. It's like I am going in circles.

You can also use paramiko package for connecting your sftp via Python.
You just have to do
pip install paramiko
Hopefully it works for you.

Related

How to solve the "pip install pygame" issue?

I am trying to use command pip install pygame in cmd, but there is error.
The error is shown as follows:
C:\Users\Administrator>pip install pygame
Collecting pygame
Using cached https://files.pythonhosted.org/packages/80/2c/3a52e7e9c097229b026b4efbe6711c600f3a84ffdc5f11fd9e7f8932368e/pygame-1.9.6-cp37-cp37m-win32.whl
Installing collected packages: pygame
Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问。: 'c:\\program files (x86)\\python37-32\\Lib\\site-packages\\pygame'
Consider using the `--user` option or check the permissions.
You are using pip version 18.1, however version 19.1.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
I follow the instruction in the error but still cannot solve the problem. And I also found whatever "pip" command cannot be installed correctly.
You can install the package as Administrator, by following these steps:
1.Right click on the Command Prompt icon
2.Select the option: Run This Program As An Administrator
3.Run the command: pip install pygames
Instead of you can use the command
pip install --user pygames
The other answers didn't work for me. I checked this site and made sure that pip, setuptools, and ez_setup were installed at the latest versions. Still no luck. Finally, I discovered the magic words here:
pip install pygame --pre
Per this, --pre option tells pip to include pre-release versions of packages when searching for the latest version. Apparently that's what's needed as of this writing (2023-02-08).
(Thanks to accddd)
check if Pip was installed correctly by opening a command prompt and entering the following command:
pip -V
output should be like:
pip 18.0 from c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\pip (python 3.7)
if pip is not install copy this file link and save it to setup.py
now open cmd and run script by typing
python setup.py
for more details check link.
when pip in install correctly install run this commond
python -m pip install -u pygame --user
For this, you have to install pygame package from the cmd (on Windows) or from the terminal (on mac). Just type pip install pygame.If it doesn't work for you, then try using this statement pip3 install pygame. If it is still showing an error then you don't have pip installed on your device and try installing pip first.

How to install urllib3[secure] without pip

I have a old RHEL5 box running python 2.7 and I have to do a local install as the regular python site-packages are on a NFS filer I cannot write to. I need to install urllib3 and according to this doc: https://urllib3.readthedocs.io/en/latest/user-guide.html#ssl-py2
I should execute:
pip install urllib3[secure]
But I cannot figure out how to get pip to install one of my local filesystems. I have done ...
python setup.py install --prefix=/apps/local_packages
But I do not know how to get the "secure" install using setup.py.
python setup.py install[secure] --prefix=/apps/local_packages
doesn't work.
You can install pip by using get-pip from documentation.
And [secure] is using for install dependencies starting from 1.11 (2015-07-21) version

Installing virtualenv without root

I'm trying to install virtualenv on a machine without root access. Note that I don't have pip either on the machine, so "pip install --user virtualenv" won't work (unless I want to install pip locally as well).
I tried the following:
wget https://pypi.python.org/packages/d4/0c/9840c08189e030873387a73b90ada981885010dd9aea134d6de30cd24cb8/virtualenv-15.1.0.tar.gz#md5=44e19f4134906fe2d75124427dc9b716
tar zvf virtualenv-15.1.0.tar.gz
python virtualenv-15.1.0/virtualenv.py venv
And got an error message:
Cannot find a wheel for setuptools
Cannot find a wheel for pip
Does this mean I need to install setuptools and pip first? But installing everything (pip and virtualenv) under "~/.local" didn't work either. I also tried using "extra-search-dir" option for virtualenv.
Related Questions:
How to Install virtualenv on a machine without root access

Installing pip for an offline machine on Python 2.7, CentOS 6.3

I'm trying to install lxml for Centos6.3, due to this issue. It looks like I've got a conflicting version of pip. The standing solution seems to re-install pip for the correct version of python.
My main issue is that all the methods I've found for installing pip require an internet connection. Is it possible to download pip install files, and then run pip install -U pip and point it at the right files?
The PyPI page for pip only has pip6.11 as a .whl. I've tried running pip install -U pip-6.1.1-py2.py3-none-any.whl and it's not worked.
I'm stumped. How do I install it?
You could try to download pip and setuptools manually from: https://pypi.org/project/pip/#files and https://pypi.org/project/setuptools/#files
get the python pip script from: https://bootstrap.pypa.io/get-pip.py
after that unzip/untar packages and run:
python get-pip.py --no-index --find-links=/path/to/pip-and-setuptools
or alternatively trying:
python setup.py install when running in unpacked folders
More here: https://github.com/pypa/pip/issues/2351

brew install python - fails OSX

Im trying to install python through brew with:
brew install python
But get the following error:
Stevens-MacBook-Pro :: ~ ‹master*› » brew install python
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/python-2.7.
Already downloaded: /Library/Caches/Homebrew/python-2.7.8_2.mountain_lion.bottle.tar.gz
==> Pouring python-2.7.8_2.mountain_lion.bottle.tar.gz
==> Caveats
Setuptools and Pip have been installed. To update them
pip install --upgrade setuptools
pip install --upgrade pip
You can install Python packages with
pip install <package>
They will install into the site-package directory
/usr/local/lib/python2.7/site-packages
See: https://github.com/Homebrew/homebrew/wiki/Homebrew-and-Python
.app bundles were installed.
Run `brew linkapps` to symlink these to /Applications.
/usr/bin/install_name_tool: object: /usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python malformed object (unknown load command 10)
Error: Failed to fix install names
The formula built, but you may encounter issues using it or linking other
formula against it.
==> /usr/local/Cellar/python/2.7.8_2/bin/python -ssetup.py --no-user-cfg instal
using one of the approaches described here:
Please make the appropriate changes for your system and try again.
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall python`
==> Summary
🍺 /usr/local/Cellar/python/2.7.8_2: 4626 files, 73M
The error messages says the post install fails, and to try installing it again with:
brew postinstall python
but the error still persists. I also tried brew linkapps and it success fully links python but when I run pip from the console I get this error:
Stevens-MacBook-Pro :: ~ ‹master*› » pip
zsh: /usr/local/bin/pip: bad interpreter: ##HOMEBREW_PREFIX##/opt/python/bin/python2.7: no such file or directory
Any idea what might be going wrong?
Pyenv is a python version management tool, something like rbenv but for python.
You could easily install and change python version via pyenv easily.
The following shows how to install python with version 2.7.8 through pyenv:
ubuntu#ubuntu:~$ pyenv install 2.7.8
Downloading Python-2.7.8.tgz...
-> http://yyuu.github.io/pythons/74d70b914da4487aa1d97222b29e9554d042f825f26cb2b93abd20fdda56b557
Installing Python-2.7.8...
Installing setuptools from https://bootstrap.pypa.io/ez_setup.py...
Installing pip from https://bootstrap.pypa.io/get-pip.py...
Installed Python-2.7.8 to /home/ubuntu/.pyenv/versions/2.7.8
as you can see, its very simple.
The command pyenv install "version" help you to install a specific versions of python easily and even pip, setuptools are also automatically installed.
I suggest giving pyenv a try!!

Categories