3

I am trying to install the ptyprocess module: https://github.com/pexpect/ptyprocess.

I cannot do a "pip install ptyprocess" as my pip is blocked by ssl issues on the server.

Also, I cannot clone the above repository and run a "python setup.py install" since there is no setup.py in the repository; instead there is a pyproject.toml which requires "pip install pyproject.yoml", but again, this is reliant on pip which is blocked.

How then can I install this module?

p.s. I've installed other modules on my server via github, but they have the desired "setup.py" and not "pyproject.toml", therefore I was able to run "python setup.py install" successfully.

Alias
  • 163
  • 8
  • Does this answer your question? [How to manually install a pypi module without pip/easy\_install?](https://stackoverflow.com/questions/13270877/how-to-manually-install-a-pypi-module-without-pip-easy-install) – Josh Correia Feb 24 '22 at 22:22

2 Answers2

1

To install a module copy the pytprocess folder (or whatever folder contains the topmost __init__.py) to your site-packages (usually in {python location}\lib\site-packages) directory. You may still need to manually install the dependencies, (in this case flit) as well. Note this only works if the package is pure python.

mousetail
  • 7,009
  • 4
  • 25
  • 45
  • Hi, thank you very much. This fixed my issue. +1. p.s. what do you mean by top `__init__.py`? There are two of them, each in different dirs. – Alias Oct 16 '19 at 14:12
  • In python, the precence of a `__init__.py` indicates that a folder is the root folder of a library. A module must either be a single file in site packages or a single folder container a `__init__.py` A package usually has one `__init__.py` for the root and possibly others in subfolders for other submodules. A `__init__.py` in a seperate root folder usually indicates a different related module, possibly for unit testing the main module or similar. – mousetail Oct 16 '19 at 18:38
0

my pip is blocked by ssl issues on the server

your actual question put aside, you should also fix this issue


Coming to your question, if the package you are trying to install is on PyPi (where pip usually looks for packages), then you always have the option to manually download it first from the files section of the projects page and then install it. In this case, there are two files available:

  1. ptyprocess-0.6.0-py2.py3-none-any.whl - This is a whl file, which is a pre-packed file created by setuptools. It is compatible with both python2 and 3 versions and has no OS restrictions ("any"). Once downloaded you can install using pip install ptyprocess-0.6.0-py2.py3-none-any.whl
  2. ptyprocess-0.6.0.tar.gz This is the source code, it can be installed using pip install ptyprocess-0.6.0.tar.gz.

This solution is of course specific to packages that are available on PyPi as a workaround if pip cannot download and install the project itself. It also works to pip install on offline machines if you just download the neccessary files on a second machine and then copy them over

FlyingTeller
  • 17,638
  • 3
  • 38
  • 53