# How to license CPLEX inside Google Colab’s Julia environment

**URL:** <https://discourse.julialang.org/t/how-to-license-cplex-inside-google-colab-s-julia-environment/128682>\
**Category:** Optimization (Mathematical)\
**Tags:** question\
**Created:** [May 4, 2025, 6:40am UTC](https://discourse.julialang.org/t/how-to-license-cplex-inside-google-colab-s-julia-environment/128682 "2025-05-04T06:40:04Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Engr\_Moiz\_Ahmad](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/engr_moiz_ahmad/32/214621_2.png) [@Engr\_Moiz\_Ahmad](https://discourse.julialang.org/u/Engr_Moiz_Ahmad)\
**Post date:** [May 4, 2025, 6:40am UTC](https://discourse.julialang.org/t/how-to-license-cplex-inside-google-colab-s-julia-environment/128682/1 "2025-05-04T06:40:04Z")

</div>

I am dealing with a multi-stage mixed-integer stochastic global supply chain optimization problem and want to solve the stage-wise problem instances using the CPLEX solver within SDDiP algorithm using the [SDDP.jl](https://juliaregistries.github.io/General/packages/redirect_to_repo/SDDP) package in Julia.

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [May 4, 2025, 9:05am UTC](https://discourse.julialang.org/t/how-to-license-cplex-inside-google-colab-s-julia-environment/128682/2 "2025-05-04T09:05:13Z")

</div>

The installation instructions for CPLEX.jl are here: [jump-dev/CPLEX.jl · JuMP](https://jump.dev/JuMP.jl/stable/packages/CPLEX/#Installation)

I haven’t tried installing CPLEX on colab, so I don’t have any other advice, sorry.

---

<div class="post-metadata">

**Author:** ![Engr\_Moiz\_Ahmad](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/engr_moiz_ahmad/32/214621_2.png) [@Engr\_Moiz\_Ahmad](https://discourse.julialang.org/u/Engr_Moiz_Ahmad)\
**Post date:** [May 5, 2025, 12:37pm UTC](https://discourse.julialang.org/t/how-to-license-cplex-inside-google-colab-s-julia-environment/128682/3 "2025-05-05T12:37:25Z")

</div>

Got it, no problem at all.

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [May 5, 2025, 7:14pm UTC](https://discourse.julialang.org/t/how-to-license-cplex-inside-google-colab-s-julia-environment/128682/4 "2025-05-05T19:14:34Z")

</div>

I see that you have posted at [https://or.stackexchange.com/questions/13152/using-cplex-in-the-julia-environment-of-google-colaboratory](https://or.stackexchange.com/questions/13152/using-cplex-in-the-julia-environment-of-google-colaboratory).

What have you tried? Have you installed CPLEX locally? Do you have a license?

You’ll likely need to download the installer locally, upload it to Colab, and then run the installer in Colab. Once installed you then need to set the correct environment variable and run `Pkg.add("CPLEX")`. I can’t test this because I don’t have a license.

---

<div class="post-metadata">

**Author:** ![Engr\_Moiz\_Ahmad](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/engr_moiz_ahmad/32/214621_2.png) [@Engr\_Moiz\_Ahmad](https://discourse.julialang.org/u/Engr_Moiz_Ahmad)\
**Post date:** [May 7, 2025, 12:42pm UTC](https://discourse.julialang.org/t/how-to-license-cplex-inside-google-colab-s-julia-environment/128682/5 "2025-05-07T12:42:32Z")

</div>

I have tried to install CPLEX using the CPLEX Studio executable with .bin extension inside Colab. I am getting the following error.  
I need guidance regarding the installation location and where to past the .bin file and then install CPLEX and the wrapper cplex.jl.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/f/3/f31a19aeb352c89948389afc01bb27a6ebfcd526.png)

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [May 7, 2025, 9:27pm UTC](https://discourse.julialang.org/t/how-to-license-cplex-inside-google-colab-s-julia-environment/128682/6 "2025-05-07T21:27:09Z")

</div>

Did you run the CPLEX installer? You need to do more than just copy-paste the installer file.

Once installed, you need to find the path of where it was installed to. The most common location is listed in the error message, `/opt/CPLEX_Studio221/cplex/bin/x86-64_linux`, but I’m not sure if this is where it will be on Colab.

---

<div class="post-metadata">

**Author:** ![Engr\_Moiz\_Ahmad](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/engr_moiz_ahmad/32/214621_2.png) [@Engr\_Moiz\_Ahmad](https://discourse.julialang.org/u/Engr_Moiz_Ahmad)\
**Post date:** [May 8, 2025, 4:09am UTC](https://discourse.julialang.org/t/how-to-license-cplex-inside-google-colab-s-julia-environment/128682/7 "2025-05-08T04:09:32Z")

</div>

I am unable to select options while running the executable file for CPLEX installation.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/c/9/c914b9cd33992acbdf27af366c4cd39fecfd8dd7.png)

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [May 8, 2025, 4:22am UTC](https://discourse.julialang.org/t/how-to-license-cplex-inside-google-colab-s-julia-environment/128682/8 "2025-05-08T04:22:00Z")

</div>

I don’t have the CPLEX installer so I cannot test, but:

- there may be an option like `-y` that allows all defaults
- you could use the terminal built-in to colab, but I think this requires a pro subscription
- you could pipe in the arguments via something like:

```julia
run(`echo -e "2\n" | $path`)

```

---

<div class="post-metadata">

**Author:** ![Engr\_Moiz\_Ahmad](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/engr_moiz_ahmad/32/214621_2.png) [@Engr\_Moiz\_Ahmad](https://discourse.julialang.org/u/Engr_Moiz_Ahmad)\
**Post date:** [May 8, 2025, 6:54pm UTC](https://discourse.julialang.org/t/how-to-license-cplex-inside-google-colab-s-julia-environment/128682/9 "2025-05-08T18:54:52Z")

</div>

I have installed the CPLEX solver by first uploading the executable (.bin) file to a directory of choice (I chose “/root”, which is the home directory in Google Colaboratory). Develop a file, named “installer.properties,” with the following contents in the same directory.

```julia
INSTALLER_UI=silent
LICENSE_ACCEPTED=TRUE
USER_INSTALL_DIR=/root

```

Then execute the following lines of code.

```julia
chmod("/root/cplex_studio2212.linux_x86_64.bin", 777)

run(`/root/cplex_studio2212.linux_x86_64.bin -f /root/installer.properties`)

ENV["CPLEX_STUDIO_BINARIES"] = "/root/cplex/bin/x86-64_linux"

```

After this, install CPLEX.jl, and you are all set to use the CPLEX solver in Julia.  
Note: “/root” directory, mentioned above, can be replaced with any directory of choice.

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [May 8, 2025, 7:11pm UTC](https://discourse.julialang.org/t/how-to-license-cplex-inside-google-colab-s-julia-environment/128682/10 "2025-05-08T19:11:40Z")

</div>

Glad to hear you got it working: )
