BKRCast Setup Anaconda3 - bellevuewa/BKRCast GitHub Wiki
System Setup
Step 1: Install EMME4.7 64-bit
Step 2: Install Anaconda 3
- Download Anaconda 3 from Anaconda3-2020.02-Windows-x86_64.exe.
- Install Anaconda 3. Use all default settings.
Step 3: create a virtual environment named BKRCast
We used to install from YML. But recent developments have introduced potential issues. From our latest experience, we recommend the following procedure. Note that the installations of 3b, 3c and 3d might exhibit slower speeds. Exercise patience during these steps.
a. Create virtual environment named BKRCast
conda create --name BKRCast --clone base
conda activate BKRCast
The BKRCast virtual environment folder is located in [anaconda_installation_folder]\envs\BKRCast
.
b. Install geopandas
pip install geopandas
Need to install geopandas
through pip.
c. Install pandana
conda install pandana --channel conda-forge
d. Install service_identity
conda install service_identity
e. Install jenkspy
conda install -c conda-forge jenkspy
f. Install toml
conda install -c conda-forge toml
g. Install pyright
conda install -c conda-forge pyright
h. Install PyQt
conda install pyqt=5.9.2
Step 4: Activate the virtual environment by using this command line:
conda activate BKRCast
If you want to exit the BKRCast virtual environment, run the command line:
conda deactivate
Step 5: Change python path in EMME to the BKRCast virtual environment
- Open EMME Desktop
- Go to Tools → Application Options → Modeller
- Change Python Path to the BKRCast environment folder that was created in Step 3. For example,
C:\Users\hdong\Anaconda3\envs\BKRCast
. - Select Install Package or Update Modeller Package and click OK.
- Go to BKRCast virutal environment
BKRCast\Lib\site-packages
. Verify emme.pth file has been copied to this location. Otherwise, manually copy this file [Emme Path]\emme.pth toenv\BKRCast\Lib\site-packages
. - Close Emme.
Step 6: Change Windows system path environment variable
Right click the Start
icon and select Settings
. In the right column, click on Advanced system settings
, followed by Environment Variables
. Double click on Path
under System variables
section. Incorporate the following paths into the path variable.
C:\Users\hdong\Anaconda3\envs\BKRCast\Library\bin
PYTHONPATH
system variable.
Step 7: Create Set paths (similar as below) to PYTHONPATH
. Your paths will be different.
%EMMEPATH%\programs;%EMMEPATH%\Python37\modeller;C:\Users\hdong\Anaconda3\envs\BKRCast\Library\bin;C:\Users\hdong\Anaconda3\envs\BKRCast;C:\Users\hdong\Anaconda3\envs\BKRCast\Library\mingw-w64\bin;C:\Users\hdong\Anaconda3\envs\BKRCast\Library\usr\bin;C:\Users\hdong\Anaconda3\envs\BKRCast\Scripts;C:\Users\hdong\Anaconda3\envs\BKRCast\bin;C:\Users\hdong\Anaconda3\condabin
sip.pyd
from env\BKRCast\Lib\site-packages
.
Step 8: Delete The sip.pyd would create conflicts with emme 4.6 installation. As a workaround just delete this file.
Step 9: Test
Open anaconda powershell prompt window. Run the following command lines.
Attention: Anaconda may automatically create a shortcut to the BKRCast virtual environment. Do not use it. It may or may not work. Always start from Anaconda prompt window.
conda activate BKRCast
python
import inro.emme.desktop.app
import inro.modeller
import geopandas
import fiona
If no error message appears, the Emme packages have been successfully installed in anaconda.
Errors Related to "module os has no attribute 'add_dll_directory'"
You might encounter an error similar to the following:
The error is most likely caused by incompatibility with fiona. The compatible version is 1.8.5. To verify, run the following command in BKRCast virtual environment.
conda list fiona
If fiona is version 1.9.6 or newer, it confirms the incompatibility. To resolve this issue, follow these steps:
pip uninstall fiona
pip install fiona==1.8.5
If you see messages like the ones in this screenshot, it means fiona 1.8.5 is already installed somewhere (likely as part of EMME installation). In this case, you can skip the fiona installation step.
Now you can test it in BKRCast virtual environment again.
python
import fiona
Errors Related to 'Some dll is not loaded'
If you encounter an error message saying some dll is not loaded, first make sure the environmental variables are configured correctly (e.g., %EMMEPATH%\programs;%EMMEPATH%\Python37\modeller are included in PYTHONPATH, not in PATH). If the error still exists, try this additional step below:
- Create a text file named
set_path_for_BKRCast.bat
in the root directory of D drive. - Add the following two lines to this batch file.
set EMMEPATH=C:\Program Files\INRO\Emme\Emme 4\Emme-4.6.0
set PATH=%EMMEPATH%\programs;%EMMEPATH%\Python37\modeller;%PATH%
This batch file ensures that Python package search commence from EMME installation, preventing potential issues where certain packages might remain undiscovered, leading to unexpected errors.
Attempt to launch EMME modeler. If it opens smoothly without any complications, you have successfully configured teh Ananconda BKRCast environmnet.
Optional software tools
Git
Download Git from https://git-scm.com/download/win. Choose latest 64-bit Windows version. Follow the installation instructions to complete installation.
Git Credential Manager
It is recommended to download and install git credential manager for Windows.
TortoiseGit
Download TortoiseGit from https://tortoisegit.org/download/. Choose latest 64-bit version. Follow the installation instruction to complete installation.
Notepad++
Notepad++ is a powerful open source text editor. here is the download link.
Model Setup
The following steps are recommended to set up the BKRCast model on a machine:
- Download setup:
- Open command prompt window (console mode). Change current directory to the working directory.
- Run command
git clone https://github.com/bellevuewa/BKRCast
. This command is to clone the BKRCast repository. This is a public repository and primarily contains scripts/programs and configuration files.
Daysim is installed in daysim_2019 subfolder. The current Daysim version BKRCast is using is 2.2.0-beta.427. - Get the BKRCast input files. Save input files under BKRCast/inputs. We no longer keep BKRCastInputs on GitHub.
- Update input_configuration.py:
- Under BKRCast root folder, open input_configuration.py in a text editor.
- Set
project_folder
to the BKRCast folder on the target machine - Set
parcels_file_folder
to the directory of the primary parcel file
The following tree diagram represents a BKRCast model directory that is ready for a model run based on the aforementioned setup guidance.