how to install python modules where pipy.org is is not accessible from iran?

Question:

so the problem is that pypi.org hase been filtered by iranian government(yes , i know it’s ridiculous!). i tried to install some python modules from Github downloaded files:
pip install moduleName
but every module has it’s own dependencies and try to connect to pipy.org to reach them. then there will be an error during installation.
is there any solution?
your help will be much appreciated.

Asked By: nariman zaeim

||

Answers:

Try and use a VPN this will bypass any block on certain sites. Just google VPN for the top results.

Answered By: d-dutchview

I live in a country that also blocks services, mostly streaming platforms. In theory, the way behind this is the same whether to watch Netflix or download python and its dependencies. That is you’ll probably need to use a VPN.

As said by d-dutchveiws, there’s tons of videos and resources on how to set up a VPN. If you do end up using a paid VPN service I would just like to add that I lived in the UAE for a while and I found that some VPN services were blocked by the country themselves. I know NordVPN did not work/was blocked by the UAE so I ended up finding expressVPN and that worked. In other words, I’d be sure not to commit to any payment plan/only use free trials because even the VPN services can be blocked. Hope I helped a bit!

Answered By: Brian C

One of the ways to solve this problem is using some mirrors of pypi that can access in Iran. This can lead to faster download/install speeds. One of mirrors you can use is iranrepo.ir. A sample of installing a package using iranrepo mirror is like this:

pip install MODULE_NAME --index-url=https://pypi.iranrepo.ir/simple
Answered By: Ria

This issue has been there for a while now, the easiest fix to this is to use proxies with pip!

pip has a --proxy option which can be used to set a proxy, all you need is a VPS located outside of the country with free internet access, then you can create a ssh tunnel between your local machine to the VPS, setting a local port would make it work as a proxy on your local machine so you can use it as a proxy!

A real world example would be like this.