Access arcpy on Linux

I have installed ArcGIS Server 10.6.1 on Linux and followed the instruction here to create a conda environment named arcgis with Python 3.6. Using the shell, I can activate the conda env and import arcpy successfully. However, the conda env does not work with any IDE (e.g., PyCharm, VS Code) or Jupyter Notebook. See below the message I got when trying to import arcpy in Jupyter Notebook. Any help will be greatly appreciated!

Great to hear you're trying out the native ArcPy project, I'd be happy to help you. It should work for anything that's running inside the conda environment, you'll just need to run the commands inside the activated environment. Here's IPython started this way:

This should also work well for Jupyter Notebooks and tools like Spyder, which can be installed into the environment. The story for other external tools is still a little complicated, the native ArcPy interface has to initialize system environment variables in order to operate. The script that executes on startup is available in $CONDA_PREFIX/etc/conda/activate.d/arcgis-server-10.6.1-py3-env_vars.sh if you'd like to take a look. The simpler way to get this along with your IDE is to start your IDE from within the active environment, so e.g. type `code` after activating the environment to start Visual Studio Code [note: I haven't tested this, but it should inherit the calling environment on creation]. Alternatively, you could create a bash script that first sourced that file. This is necessary because tools that call into ArcPy need to initialize the server pieces internally which are used for their dependent calls. We are looking at simplifying this for a future release, but hopefully that's enough information to get you started.

If you want to try and make this work in Visual Studio Code today without any additional setup of environment variables, you could also set them up manually with VScode (see Configuring Python Environments in Visual Studio Code ) , but it's probably easiest to run code from within the active environment.