# Fpm not finding compiler

**URL:** https://fortran-lang.discourse.group/t/fpm-not-finding-compiler/9042
**Category:** Help
**Created:** [January 5, 2025, 12:45am UTC](https://fortran-lang.discourse.group/t/fpm-not-finding-compiler/9042 "2025-01-05T00:45:21Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![richo123](https://avatars.discourse-cdn.com/v4/letter/r/f08c70/32.png) [@richo123](https://fortran-lang.discourse.group/u/richo123)
#### Post date: [January 5, 2025, 12:45am UTC](https://fortran-lang.discourse.group/t/fpm-not-finding-compiler/9042/1 "2025-01-05T00:45:21Z")

</div>

I installed fpm on Ubuntu 24.04 using a snap package and set up the first\_steps sample project. When I run “fortran-fpm run” I get an error which says that fpm cannot find the compiler gfortran. However gfortran is definitely in my PATH and is located at /bin/gfortran. The log file I get has the line  
sh: 1: /bin/gfortran: not found

Is there an environment variable needing to be set? Note that fortran-fpm is the snap package command for fpm…

---

<div class="post-metadata">

### Author: ![ivanpribec](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/ivanpribec/32/3290_2.png) [@ivanpribec](https://fortran-lang.discourse.group/u/ivanpribec)
#### Post date: [January 5, 2025, 1:23am UTC](https://fortran-lang.discourse.group/t/fpm-not-finding-compiler/9042/2 "2025-01-05T01:23:36Z")

</div>

You could try setting the environment variable `FPM_FC`,

```txt
> export FPM_FC=`which gfortran`

```

Alternatively you can override on the command line using `--compiler <compiler>`:

```txt
$ fpm run --compiler `which gfortran`
 + mkdir -p build/dependencies
test_fpm.f90 done.
libtest_fpm.a done.
main.f90 done.
test_fpm done.
[100%] Project compiled successfully.
 Hello, test_fpm!

```

But by default it will try to use `gfortran`.

---

<div class="post-metadata">

### Author: ![urbanjost](https://avatars.discourse-cdn.com/v4/letter/u/0ea827/32.png) [@urbanjost](https://fortran-lang.discourse.group/u/urbanjost)
#### Post date: [January 5, 2025, 8:38am UTC](https://fortran-lang.discourse.group/t/fpm-not-finding-compiler/9042/3 "2025-01-05T08:38:28Z")

</div>

How familiar are you with snap? It intentionally runs the applications in a container with limited access to the host system. That is a very unusual way to install fpm. If you install it as a conventional application and/or build it from the single-source-file it will run in a normal shell with access to the base operating system applications which I assume is where you installed the compiler (?).

[https://fpm.fortran-lang.org/install/index.html](https://fpm.fortran-lang.org/install/index.html)

---

<div class="post-metadata">

### Author: ![richo123](https://avatars.discourse-cdn.com/v4/letter/r/f08c70/32.png) [@richo123](https://fortran-lang.discourse.group/u/richo123)
#### Post date: [January 5, 2025, 1:24pm UTC](https://fortran-lang.discourse.group/t/fpm-not-finding-compiler/9042/4 "2025-01-05T13:24:38Z")

</div>

Yes that was the problem. snap runs in a container and restricts the environment making it cumbersome to run dev apps. I downloaded the binary and it works fine. Pity that fpm is not in the Debian/Ubuntu apt repo to avoid these complications or that the snap docs for fortran-fpm are not more helpful

---

<div class="post-metadata">

### Author: ![Harper](https://avatars.discourse-cdn.com/v4/letter/h/b5ac83/32.png) [@Harper](https://fortran-lang.discourse.group/u/Harper)
#### Post date: [January 5, 2025, 7:56pm UTC](https://fortran-lang.discourse.group/t/fpm-not-finding-compiler/9042/5 "2025-01-05T19:56:35Z")

</div>

I often had trouble finding compilers in my Linux system after installing them until I realised that commands like these tell you where they are:

```auto
locate bin/gfortran
locate bin/ifx 

```

You may also find some old versions lurking in your machine.
