Build and Debug the Code
'command not found' during development setup on Linux/macOS
When running the setup script (or any script, for that matter) on Linux or macOS, you see an error of the form:
This indicates that the .sh script file has been saved with Windows-style CRLF line endings instead of Linux/Unix style LF line endings.
Open the script in Visual Studio or Visual Studio Code and at the bottom right of the editor window you will see a line ending hint
Click that and choose 'LF' to correct the line endings and re-run the script.
Models not found
When building you see:
Ensure you've run the development setup scripts before attempting to build
Port already in use
If you see:
Our first suggestion is to no longer use port 5000. It's a reserved port, though not all operating systems are actively using it. We prefer port 32168 since it's easy to remember and well out of harm's way of other used ports.
You can change the external port that CodeProject.AI uses by editing the
appsettings.json file and changing the value of the
variable. In the demo app there is a Port setting you will need to edit to match
the new port.
Failing that, shut down any application using port 5000 (including any installed version of CodeProject.AI Server if you're trying to run in Development mode in Visual Studio)..
Can't find custom models
When CodeProject.AI Server is installed it will comes with multiple object detection modules. All generally work the same, with the differences being in the languages and platforms supported as well as the models that are used.
- Ensure Object Object detection is enabled (it is by default)
Use the provided custom models, or
a) add your own models to the module's custom model folder (eg
C:\Program Files\CodeProject\AI\modules\ObjectDetectionYolo\custom-modelsfor the Python YOLO detector, or
C:\Program Files\CodeProject\AI\modules\ObjectDetectionNet\custom-modelsfor the .NET Object detector, just to name two modules)
b) specify a directory that will contain the models (See the Docker guide)
To specify a different folder to use for custom models, you can
- Set the
--Modules:ObjectDetectionYolo:EnvironmentVariables:CUSTOM_MODELS_DIRparameter when launching, or
- Set the
Modules:ObjectDetectionYolo:EnvironmentVariables:CUSTOM_MODELS_DIRenvironment variable, or
- Set the
CUSTOM_MODELS_DIRvalue in the modulesettings.json file in the ObjectDetectionYolo folder, or
- Set the global override (to be deprecated!) variable
MODELSTORE-DETECTIONto point to your custom object folder, or
(For Docker) Map the folder containing your custom models (eg.
C:\MyCustomModels) to the Object Detection's custom assets folder (
/app/modules/ObjectDetectionYolo/custom-models). An example would be:Text Only
This mounts the
C:\MyCustomModelsdirectory on my local system and maps it to the /app/modules/ObjectDetectionYolo/custom-models folder in the Docker container. Now, when CodeProject.AI Server is looking for the list of custom models, it will look in
Server startup failed
Ensure you've run the development setup scripts before attempting to start the server.
Background Remover doesn't run VS Debug GPU
Having a path to your development solution directory that is too long will prevent some modules from working due to the 256 char limit on file names in Windows. If you see something like the following error:
Simply move the directory with the repo in it to a shorter directory, like C:\Dev, and run the Clean and Setup again. This is required as the Python virtual environment has a hard link to the old directory structure.