Home › Forums › FABRIC General Questions and Discussion › Local FABRIC Setup on Mac
- This topic has 4 replies, 2 voices, and was last updated 2 years, 2 months ago by Devin Lane.
-
AuthorPosts
-
October 6, 2022 at 12:00 am #3265
Hi,
When trying to set up the fabric API on Mac, I can get it mostly working; it seems there are some issues with environment variables that I’m not sure how to fix. Below is an example error I am receiving:
—————————————————————————
AttributeError Traceback (most recent call last)
Input In [1], in <cell line: 5>()
1 from fabrictestbed_extensions.fablib.fablib import FablibManager as fablib_manager
3 fablib = fablib_manager()
—-> 5 fablib.show_config()File /opt/anaconda3/envs/fabric/lib/python3.9/site-packages/fabrictestbed_extensions/fablib/fablib.py:881, in FablibManager.show_config(self)
879 def show_config(self):
880 table = []
–> 881 for var, val in self.get_config().items():
882 table.append([str(var), str(val)])
884 print(f”{tabulate(table)}”)File /opt/anaconda3/envs/fabric/lib/python3.9/site-packages/fabrictestbed_extensions/fablib/fablib.py:901, in FablibManager.get_config(self)
888 def get_config(self) -> Dict[str, str]:
889 “””
890 Gets a dictionary mapping keywords to configured FABRIC environment
891 variable values values.
(…)
894 :rtype: Dict[String, String]
895 “””
896 return {‘credmgr_host’: self.credmgr_host,
897 ‘orchestrator_host’: self.orchestrator_host,
898 ‘fabric_token’: self.fabric_token,
899 ‘project_id’: self.project_id,
900 ‘bastion_username’: self.bastion_username,
–> 901 ‘bastion_key_filename’: self.bastion_key_filename,
902 ‘bastion_public_addr’: self.bastion_public_addr,
903 ‘bastion_passphrase’: self.bastion_passphrase,
904 # ‘bastion_private_ipv4_addr’: self.bastion_private_ipv4_addr,
905 # ‘slice_public_key’: self.get_default_slice_public_key(),
906 ‘slice_public_key_file’: self.get_default_slice_public_key_file(),
907 ‘slice_private_key_file’: self.get_default_slice_private_key_file(),
908 ‘fabric_slice_private_key_passphrase’: self.get_default_slice_private_key_passphrase(),
909 ‘fablib_log_file’: self.get_log_file(),
910 ‘fablib_log_level’: self.get_log_level()
911
912 }AttributeError: ‘FablibManager’ object has no attribute ‘bastion_key_filename’
Could someone help with this?
Thanks.
October 6, 2022 at 9:47 am #3266I think you need to add your bastion key to the fabric_rc file. Refer to the “Confgure Environment” example note book. The second to last cell shows what needs to be set on the fabric_rc file.
October 6, 2022 at 1:53 pm #3267Okay, I went through that and it still isn’t working. One thing I have noticed is that the environment variables aren’t persistent; I restarted my computer and the exported variables were no longer present. Could this have something to do with Mac using zsh?
October 6, 2022 at 3:47 pm #3271You can make those env vars persistent in any way you can on your machine. The important part is that they are set before you run your FABlib application OR if you are using JupyterLab on your machine, you will need have the vars set before you start JupyterLab.
On the FABRIC JupyterHub, we skip this issue by having the application read the fabric_rc file and set the vars. You might want to do this as well. The easiest way to do this is to put all your FABRIC config files in the same place as on the JupyterHub (i.e. ${HOME}/work/fabric_config/). You can also set a different location whey you create a FABlib manager.
October 7, 2022 at 6:10 pm #3291As an update, I found a pretty good solution.
- Update the configure_environment jupyter notebook to match the file structure of your local machine.
- Run the notebook.
- Shut down Jupyter server.
- ‘source’ the fabric_rc file created from the configure_environment notebook:
- source <path_to_fabric_rc>
- Start Jupyter server.
That should work. Please respond to this post if something seems wrong or if anyone else is having this issue.
-
AuthorPosts
- You must be logged in to reply to this topic.