# Installing Fenics using Spack

**URL:** <https://fenicsproject.discourse.group/t/installing-fenics-using-spack/9728>\
**Category:** General\
**Created:** [November 10, 2022, 5:57pm UTC](https://fenicsproject.discourse.group/t/installing-fenics-using-spack/9728 "2022-11-10T17:57:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![PatTheTrickster](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/patthetrickster/32/4371_2.png) [@PatTheTrickster](https://fenicsproject.discourse.group/u/PatTheTrickster)\
**Post date:** [November 10, 2022, 5:57pm UTC](https://fenicsproject.discourse.group/t/installing-fenics-using-spack/9728/1 "2022-11-10T17:57:30Z")

</div>

I am following the instructions of installing fenics from the github readme. The installation fails when trying to install py-fenics-dolfinx and spack stops running.

[+] /home/patrick/spack/opt/spack/linux-ubuntu22.04-skylake\_avx512/gcc-11.3.0/metis-5.1.0-tmxbxt7urbxjmhbtvzuoj3znlfxypoo4  
==\> Installing fenics-ufcx-0.5.0-drriawf5rn3sarrmtykqcvgitezuay3q  
==\> No binary for fenics-ufcx-0.5.0-drriawf5rn3sarrmtykqcvgitezuay3q found: installing from source  
==\> Fetching [https://github.com/FEniCS/ffcx/archive/v0.5.0.tar.gz](https://github.com/FEniCS/ffcx/archive/v0.5.0.tar.gz)  
==\> No patches needed for fenics-ufcx  
==\> fenics-ufcx: Executing phase: ‘cmake’  
==\> fenics-ufcx: Executing phase: ‘build’  
==\> fenics-ufcx: Executing phase: ‘install’  
==\> fenics-ufcx: Successfully installed fenics-ufcx-0.5.0-drriawf5rn3sarrmtykqcvgitezuay3q  
Fetch: 1.54s. Build: 0.58s. Total: 2.12s.  
[+] /home/patrick/spack/opt/spack/linux-ubuntu22.04-skylake\_avx512/gcc-11.3.0/fenics-ufcx-0.5.0-drriawf5rn3sarrmtykqcvgitezuay3q  
==\> Error: py-fenics-dolfinx-0.5.1-asohrdf7ofl4pwsbvpx5zompx6vxiz5g: Package was not installed  
==\> Updating view at /home/patrick/spack/var/spack/environments/fenicsx-env/.spack-env/view  
==\> Error: Installation request failed. Refer to reported errors for failing package(s).

These are last couple lines from first run  
Then I ran it again and saw this error in the beginning

==\> Installing libxml2-2.10.1-ffbv3v3g6gsewbdzjwxma6bnxarrqbo2  
==\> No binary for libxml2-2.10.1-ffbv3v3g6gsewbdzjwxma6bnxarrqbo2 found: installing from source  
==\> Cannot find version 2.10.1 in url\_list  
==\> Error: FetchError: All fetchers failed for spack-stage-libxml2-2.10.1-ffbv3v3g6gsewbdzjwxma6bnxarrqbo2

/home/patrick/spack/lib/spack/spack/package\_base.py:1468, in do\_fetch:  
1465  
1466 self.stage.create()  
1467 err\_msg = None if not self.manual\_download else self.download\_instr

> > 1468 start\_time = time.time()  
> > 1469 self.stage.fetch(mirror\_only, err\_msg=err\_msg)  
> > 1470 self.\_fetch\_time = time.time() - start\_time  
> > 1471

Also when running spack --debug install … I get this

==\> [2022-11-10-11:42:16.913134] Reading config from file /home/patrick/spack/var/spack/environments/fenicsx-env/spack.yaml  
==\> [2022-11-10-11:42:16.915567] Using environment ‘fenicsx-env’  
==\> [2022-11-10-11:42:16.920774] Imported install from built-in commands  
==\> [2022-11-10-11:42:16.922353] Imported install from built-in commands  
==\> [2022-11-10-11:42:16.923149] LexError: Invalid character, ‘.’, in ‘…’ at index 0  
==\> [2022-11-10-11:42:16.923214] Error: Invalid character, ‘.’, in ‘…’ at index 0  
Traceback (most recent call last):  
File “/home/patrick/spack/lib/spack/spack/main.py”, line 1007, in main  
return \_main(argv)  
File “/home/patrick/spack/lib/spack/spack/main.py”, line 962, in \_main  
return finish\_parse\_and\_run(parser, cmd\_name, env\_format\_error)  
File “/home/patrick/spack/lib/spack/spack/main.py”, line 990, in finish\_parse\_and\_run  
return \_invoke\_command(command, parser, args, unknown)  
File “/home/patrick/spack/lib/spack/spack/main.py”, line 639, in \_invoke\_command  
return\_val = command(parser, args)  
File “/home/patrick/spack/lib/spack/spack/cmd/install.py”, line 531, in install  
abstract\_specs, concrete\_specs = specs\_from\_cli(args, install\_kwargs, reporter)  
File “/home/patrick/spack/lib/spack/spack/cmd/install.py”, line 444, in specs\_from\_cli  
abstract\_specs = spack.cmd.parse\_specs(args.spec)  
File “/home/patrick/spack/lib/spack/spack/cmd/ **init**.py”, line 224, in parse\_specs  
specs = spack.spec.parse(sargs)  
File “/home/patrick/spack/lib/spack/spack/spec.py”, line 5410, in parse  
return SpecParser().parse(string)  
File “/home/patrick/spack/lib/spack/spack/parse.py”, line 159, in parse  
self.setup(text)  
File “/home/patrick/spack/lib/spack/spack/parse.py”, line 156, in setup  
self.push\_tokens(self.lexer.lex(text))  
File “/home/patrick/spack/lib/spack/spack/parse.py”, line 90, in lex  
tokens = self.lex\_word(word)  
File “/home/patrick/spack/lib/spack/spack/parse.py”, line 83, in lex\_word  
raise LexError(msg, word, word.index(remainder))  
spack.parse.LexError: Invalid character, ‘.’, in ‘…’ at index 0

Any help would be much appreciated!

---

<div class="post-metadata">

**Author:** ![nate](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/nate/32/17_2.png) [@nate](https://fenicsproject.discourse.group/u/nate)\
**Post date:** [November 10, 2022, 7:05pm UTC](https://fenicsproject.discourse.group/t/installing-fenics-using-spack/9728/2 "2022-11-10T19:05:23Z")

</div>

Can you share the exact command you ran to install `py-fenics-dolfinx` and I’ll give it a go?

---

<div class="post-metadata">

**Author:** ![PatTheTrickster](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/patthetrickster/32/4371_2.png) [@PatTheTrickster](https://fenicsproject.discourse.group/u/PatTheTrickster)\
**Post date:** [November 10, 2022, 7:09pm UTC](https://fenicsproject.discourse.group/t/installing-fenics-using-spack/9728/3 "2022-11-10T19:09:48Z")

</div>

I actually successfully got it to build, what I did was delete any traces of dolfinx/basix from my system installations and it appears to be working right now!
