# Unable to install ampl\_module\_base (python AMPL API)

**URL:** <https://discuss.ampl.com/t/unable-to-install-ampl-module-base-python-ampl-api/554>\
**Category:** New to AMPL\
**Tags:** errors-and-messages\
**Created:** [May 15, 2023, 3:51pm UTC](https://discuss.ampl.com/t/unable-to-install-ampl-module-base-python-ampl-api/554 "2023-05-15T15:51:22Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bhartendu\_Awasthi](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/bhartendu_awasthi/32/277_2.png) [@Bhartendu\_Awasthi](https://discuss.ampl.com/u/Bhartendu_Awasthi)\
**Post date:** [May 15, 2023, 3:51pm UTC](https://discuss.ampl.com/t/unable-to-install-ampl-module-base-python-ampl-api/554/1 "2023-05-15T15:51:22Z")

</div>

I was following [Initial Setup — AMPL API 2.1 (amplpy-0.15.0) documentation](https://amplpy.readthedocs.io/en/latest/getting-started.html) to install amplpy in python.

Below line runs fine :

# Install Python API for AMPL

`$ python -m pip install amplpy --upgrade`

However, while running the below line, I get an **ERROR** :

# Install HiGHS and Gurobi (AMPL is installed automatically with any solver)

`$ python -m amplpy.modules install highs`

ERROR

```auto
spyder-env ❯ python -m amplpy.modules install highs                                
$ /Users/bawasthi/miniconda3/envs/spyder-env/bin/python -m pip install -i https://pypi.ampl.com ampl_module_base ampl_module_highs
Looking in indexes: https://pypi.ampl.com
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: UNSAFE_LEGACY_RENEGOTIATION_DISABLED] unsafe legacy renegotiation disabled (_ssl.c:997)'))': /ampl-module-base/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: UNSAFE_LEGACY_RENEGOTIATION_DISABLED] unsafe legacy renegotiation disabled (_ssl.c:997)'))': /ampl-module-base/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: UNSAFE_LEGACY_RENEGOTIATION_DISABLED] unsafe legacy renegotiation disabled (_ssl.c:997)'))': /ampl-module-base/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: UNSAFE_LEGACY_RENEGOTIATION_DISABLED] unsafe legacy renegotiation disabled (_ssl.c:997)'))': /ampl-module-base/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: UNSAFE_LEGACY_RENEGOTIATION_DISABLED] unsafe legacy renegotiation disabled (_ssl.c:997)'))': /ampl-module-base/
Could not fetch URL https://pypi.ampl.com/ampl-module-base/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.ampl.com', port=443): Max retries exceeded with url: /ampl-module-base/ (Caused by SSLError(SSLError(1, '[SSL: UNSAFE_LEGACY_RENEGOTIATION_DISABLED] unsafe legacy renegotiation disabled (_ssl.c:997)'))) - skipping
ERROR: Could not find a version that satisfies the requirement ampl_module_base (from versions: none)
ERROR: No matching distribution found for ampl_module_base
Error: Failed to install modules.

```

Could you please help. Many thanks.

 ![Screenshot 2023-05-15 at 9.14.56 PM](https://us1.discourse-cdn.com/flex019/uploads/ampl/original/1X/07319785d036c6c1e62c1b5a5d39b3b8fdec319c.jpeg)

Regards  
Bhartendu

---

<div class="post-metadata">

**Author:** ![fdabrandao](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/fdabrandao/32/63_2.png) [@fdabrandao](https://discuss.ampl.com/u/fdabrandao)\
**Post date:** [May 15, 2023, 4:11pm UTC](https://discuss.ampl.com/t/unable-to-install-ampl-module-base-python-ampl-api/554/2 "2023-05-15T16:11:32Z")

</div>

Hi @Bhartendu_Awasthi,

Thank you for reporting this issue. Could you please try with the following:

```bash
python -m amplpy.modules install highs --trusted-host=pypy.ampl.com

```

`--trusted-host=pypy.ampl.com` should tell `pip` to trust our Python Package Index.

---

<div class="post-metadata">

**Author:** ![Bhartendu\_Awasthi](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/bhartendu_awasthi/32/277_2.png) [@Bhartendu\_Awasthi](https://discuss.ampl.com/u/Bhartendu_Awasthi)\
**Post date:** [May 15, 2023, 4:14pm UTC](https://discuss.ampl.com/t/unable-to-install-ampl-module-base-python-ampl-api/554/3 "2023-05-15T16:14:44Z")

</div>

Thanks for your reply.

However, I am still getting the same error:

 ![screenshot](https://us1.discourse-cdn.com/flex019/uploads/ampl/original/1X/5a4a208ed1d4fd1df6c61013609226d3338b5ca5.jpeg)

---

<div class="post-metadata">

**Author:** ![fdabrandao](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/fdabrandao/32/63_2.png) [@fdabrandao](https://discuss.ampl.com/u/fdabrandao)\
**Post date:** [May 15, 2023, 4:43pm UTC](https://discuss.ampl.com/t/unable-to-install-ampl-module-base-python-ampl-api/554/4 "2023-05-15T16:43:27Z")

</div>

Could you please try installing the modules as follows:

```bash
python -m pip install -i https://portal.ampl.com/dl/pypi ampl_module_base ampl_module_highs

```

---

<div class="post-metadata">

**Author:** ![Bhartendu\_Awasthi](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/bhartendu_awasthi/32/277_2.png) [@Bhartendu\_Awasthi](https://discuss.ampl.com/u/Bhartendu_Awasthi)\
**Post date:** [May 15, 2023, 4:45pm UTC](https://discuss.ampl.com/t/unable-to-install-ampl-module-base-python-ampl-api/554/5 "2023-05-15T16:45:43Z")

</div>

Unfortunately still getting an error:

 ![Screenshot 2023-05-15 at 10.14.54 PM](https://us1.discourse-cdn.com/flex019/uploads/ampl/original/1X/b08fa8686273a4d961b5c295dcadffba1b00293f.jpeg)

---

<div class="post-metadata">

**Author:** ![fdabrandao](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/fdabrandao/32/63_2.png) [@fdabrandao](https://discuss.ampl.com/u/fdabrandao)\
**Post date:** [May 15, 2023, 5:08pm UTC](https://discuss.ampl.com/t/unable-to-install-ampl-module-base-python-ampl-api/554/6 "2023-05-15T17:08:36Z")

</div>

In a message before I had written `--trusted-host=pypy.ampl.com` by mistake, when it should have been `--trusted-host=pypi.ampl.com`. Could you please try with:

```auto
python -m amplpy.modules install highs --trusted-host=pypi.ampl.com --trusted-host=portal.ampl.com

```

---

<div class="post-metadata">

**Author:** ![fdabrandao](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/fdabrandao/32/63_2.png) [@fdabrandao](https://discuss.ampl.com/u/fdabrandao)\
**Post date:** [May 15, 2023, 5:33pm UTC](https://discuss.ampl.com/t/unable-to-install-ampl-module-base-python-ampl-api/554/7 "2023-05-15T17:33:30Z")

</div>

Upgrading `pip` (`pip install pip --upgrade`) may also eventually fix this issue. It is one of the possible solutions mentioned in: [python - pip install fails with "connection error: [SSL: CERTIFICATE\_VERIFY\_FAILED] certificate verify failed (\_ssl.c:598)" - Stack Overflow](https://stackoverflow.com/a/29751768)

---

<div class="post-metadata">

**Author:** ![Bhartendu\_Awasthi](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/bhartendu_awasthi/32/277_2.png) [@Bhartendu\_Awasthi](https://discuss.ampl.com/u/Bhartendu_Awasthi)\
**Post date:** [May 16, 2023, 12:37am UTC](https://discuss.ampl.com/t/unable-to-install-ampl-module-base-python-ampl-api/554/8 "2023-05-16T00:37:07Z")

</div>

Still does not work. Is there a manual or another alternative way of installing the packages.

 ![Screenshot 2023-05-16 at 6.04.32 AM](https://us1.discourse-cdn.com/flex019/uploads/ampl/original/1X/01e1ff73d4c3e1f99207f372b5fedda6d24e4f19.jpeg)

---

<div class="post-metadata">

**Author:** ![fdabrandao](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/fdabrandao/32/63_2.png) [@fdabrandao](https://discuss.ampl.com/u/fdabrandao)\
**Post date:** [May 16, 2023, 1:04pm UTC](https://discuss.ampl.com/t/unable-to-install-ampl-module-base-python-ampl-api/554/9 "2023-05-16T13:04:18Z")

</div>

You can download the .whl packages manually from [Links for ampl-module-base](https://portal.ampl.com/dl/pypi/ampl-module-base/) and [Links for ampl-module-highs](https://portal.ampl.com/dl/pypi/ampl-module-highs/)

For instance, for macOS you could download [ampl\_module\_highs-20230227-py3-none-macosx\_10\_9\_universal2.whl](https://portal.ampl.com/dl/pypi/ampl-module-highs/ampl_module_highs-20230227-py3-none-macosx_10_9_universal2.whl) and [ampl\_module\_base-20230512-py3-none-macosx\_10\_9\_universal2.whl](https://portal.ampl.com/dl/pypi/ampl-module-base/ampl_module_base-20230512-py3-none-macosx_10_9_universal2.whl). You can then install them with:

```bash
$ python -m pip install ampl_module_base-*.whl ampl_module_highs-*.whl

```

Another alternative is to download an [AMPL CE bundle](https://portal.ampl.com/user/ampl/request/amplce/new), and then point to the AMPL installation directory as follows:

```python
from amplpy import AMPL, add_to_path
add_to_path(r"full path to the AMPL installation directory")
ampl = AMPL()

```

Regarding the errors you are observing, we were still not able to reproduce them. Is this happening behind some firewall or VPN?

---

<div class="post-metadata">

**Author:** ![Bhartendu\_Awasthi](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/bhartendu_awasthi/32/277_2.png) [@Bhartendu\_Awasthi](https://discuss.ampl.com/u/Bhartendu_Awasthi)\
**Post date:** [May 16, 2023, 5:27pm UTC](https://discuss.ampl.com/t/unable-to-install-ampl-module-base-python-ampl-api/554/10 "2023-05-16T17:27:22Z")

</div>

It works ! 🙂 [used your option 1]. Thank you very much @fdabrandao for your patience in answering my question.  
Since its my office machine may be some firewalls were causing some issue (general does not happen).

2 questions:  
a) [Private Index](https://portal.ampl.com/dl/pypi/) there are not all solvers especially CP ones : ilogcp and gecode. These get shipped with AMPL installation otherwise. Is there a way to call these solvers via python API ?  
b) Does AMPL has any plans to onboard CP-SAT solver by or tools ?

Many thanks again,  
Bhartendu Awasthi

---

<div class="post-metadata">

**Author:** ![fdabrandao](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/fdabrandao/32/63_2.png) [@fdabrandao](https://discuss.ampl.com/u/fdabrandao)\
**Post date:** [May 18, 2023, 11:09am UTC](https://discuss.ampl.com/t/unable-to-install-ampl-module-base-python-ampl-api/554/11 "2023-05-18T11:09:12Z")

</div>

Hi @Bhartendu_Awasthi,

We have just made gecode and ilogcp available as modules:

- [Links for ampl-module-gecode](https://portal.ampl.com/dl/pypi/ampl-module-gecode/)
- [Links for ampl-module-ilogcp](https://portal.ampl.com/dl/pypi/ampl-module-ilogcp/)

Regarding CP-SAT, I believe the issue was the interface being not as generic as other solver interfaces, which would complicate the development of the driver. @Gleb_Belov, is this correct?

---

<div class="post-metadata">

**Author:** ![Gleb\_Belov](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/gleb_belov/32/51_2.png) [@Gleb\_Belov](https://discuss.ampl.com/u/Gleb_Belov)\
**Post date:** [May 18, 2023, 11:31am UTC](https://discuss.ampl.com/t/unable-to-install-ampl-module-base-python-ampl-api/554/12 "2023-05-18T11:31:20Z")

</div>

The CP-SAT API docu is not very verbose but the example seems straightforward: [CP-SAT 解題工具 &nbsp;|&nbsp; OR-Tools &nbsp;|&nbsp; Google for Developers](https://developers.google.com/optimization/cp/cp_solver), so I think a driver implementation should be similar to other APIs

---

<div class="post-metadata">

**Author:** ![Bhartendu\_Awasthi](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/bhartendu_awasthi/32/277_2.png) [@Bhartendu\_Awasthi](https://discuss.ampl.com/u/Bhartendu_Awasthi)\
**Post date:** [May 18, 2023, 11:58am UTC](https://discuss.ampl.com/t/unable-to-install-ampl-module-base-python-ampl-api/554/13 "2023-05-18T11:58:23Z")

</div>

Thank you ! Very helpful.

---

<div class="post-metadata">

**Author:** ![Bhartendu\_Awasthi](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/bhartendu_awasthi/32/277_2.png) [@Bhartendu\_Awasthi](https://discuss.ampl.com/u/Bhartendu_Awasthi)\
**Post date:** [May 18, 2023, 11:59am UTC](https://discuss.ampl.com/t/unable-to-install-ampl-module-base-python-ampl-api/554/14 "2023-05-18T11:59:00Z")

</div>

Thanks for the update.
