Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Cannot source oneAPI's 'setvars.sh' in fish

DavidCortes
Beginner
514 Views

Products from oneAPI are meant to be loaded into a terminal session through the script:

/opt/intel/oneapi/setvars.sh

 

The script has this at the header:

#!/bin/sh
# shellcheck shell=sh
# shellcheck source=/dev/null
# shellcheck disable=SC2312

Which suggests that it should be usable by sourcing it in a generic shell. It works correctly if one uses 'bash' or 'zsh' as shell, but it doesn't work at all with 'fish' (a very popular shell for unix systems), unlike common software such as 'conda' (which correctly handles a wide variety of shells in the scripts it sources).

 

This is the error that I get when trying to source it using 'fish':

~> source /opt/intel/oneapi/setvars.sh  
/opt/intel/oneapi/setvars.sh (line 75): Unsupported use of '='. In fish, please use 'set script_name setvars.sh'.
script_name=setvars.sh
^~~~~~~~~~~~~~~~~~~~~^
from sourcing file /opt/intel/oneapi/setvars.sh
source: Error while reading file '/opt/intel/oneapi/setvars.sh'

0 Kudos
4 Replies
SofeaAzrin_A_Intel
417 Views

Hi, thank you for your question.

 

The setvars.sh script provided by Intel oneAPI is written for sh compatible shells which include bash and zsh, but not fish. To source environment variables and configurations in fish, you would typically need a script written specifically for the fish syntax.


0 Kudos
DavidCortes
Beginner
335 Views

And that, precisely, is the problem: the script provided by intel's oneAPI is not usable with fish.

Compare that against other software that might typically be used alongside with oneAPI products, such as 'conda', which in contrast offers variants of their sourcing script for a wide variety of shells, including bash, zsh, xonsh, and others:
https://github.com/conda/conda/blob/da66071bb4a8bc4cfba97c8f05ec20e8e3ee5f1c/conda/shell/etc/fish/conf.d/conda.fish#L60

0 Kudos
SofeaAzrin_A_Intel
356 Views

Kindly note that we were unable to get any response from your side. We will be awaiting your reply in the next 24 business hour then we will proceed with the closure of this ticket.


0 Kudos
SofeaAzrin_A_Intel
246 Views

Specifically, it has a different syntax for setting variables compared to the Bash shell. To source the script in Fish, you would need to translate the syntax to something Fish understands or run the script in a compatible shell. Maybe like you need to create a wrapper script that sets the environment variables in Bash and then prints them out in a format that Fish can understand. Then you can source this output in Fish.


0 Kudos
Reply