Skip to content
GitHubCaps edited this page Jan 14, 2021 · 22 revisions

Before you begin, read this!

https://packaging.python.org/tutorials/installing-packages/

We are not responsible if you mess up your system!

You have been WARNED!

General approach to install bCNC on any system

From PyPI

You need python3.6 with tkinter support and working pip. Then you can use pip install bCNC to install bCNC and all it's dependencies (except for tkinter, which has to be installed/compiled as integral part of python). After that it can be launched using python -m bCNC command.

Note that if you have both python2.7 and python3 installed, you might need to use python2 and/or pip2 binaries rather than just python and/or pip, to make sure that the correct version of python is used.

Update: bCNC supports python3, however python2.7 is deprecated (still supported) and more modules are dropping 2.7 support (will likely to be phased out soon).

If you don't have pip binary for the correct python version in your PATH, you can launch it by calling python -m pip rather than just pip.

https://pypi.org/project/bCNC/

Special cases on specific OS and other ways to run:

From git

If you want to use pip install --upgrade git+https://github.com/vlachoudis/bCNC to install latest development version from github (because you are a developer, or you want to try new cool features), you will also need git binary installed and available in your PATH, so pip can use it to fetch the source code from github.

If you don't have git installed, you can use pip install --upgrade https://github.com/vlachoudis/bCNC/archive/master.zip

Alternatively you can use pip install . directly in git folder.

Or just download sources from github (zip/tar file), unpack it and launch python -m bCNC in the bCNC directory (not from bCNC-master) or double clicking the main .py file. This should work if you've previously done pip install bCNC (in which case, pip downloaded and installed all the required dependencies) or you already have all the required dependencies.


Linux / BSD

  1. Update your system (Optional) and install git, python (with tkinter support) and pip:
	#This is specific for Debian/Ubuntu, other distros have other package managers than apt-get
	sudo apt-get update
	sudo apt-get upgrade
	sudo apt-get install git python python3-tk python-pip
  1. Install bCNC using pip and launch it:
	sudo pip install --upgrade bCNC
	#sudo pip install --upgrade git+https://github.com/vlachoudis/bCNC #if you want git version
	python -m bCNC

Happy milling!

Building packages for your distribution

If you are package maintainer of distribution, there's likely some unified way to make Python packages for your distro. Eg.:


Windows

Using PIP Python 3.x

1.) Install python 3: https://www.python.org/downloads/ Install Python 3.9.0 on Windows 10

Do not forget to install Tcl/Tk and PIP modules while doing so. Also check that python will be added to path: Install pip Tcl/Tk and py launcher

Install Python 3 9_3

2.) Open commandline and install bCNC using pip:

Press Windows+R to open “Run” box. Type “cmd” and then click “OK” to open a regular Command Prompt. opencommandprompt

py -m pip install bCNC py -m pip install bCNC

3.) Launch bCNC py -m bCNC py -m bCNC

bCNC is loaded and Windows Defender may popup, Happy CNC milling! Windows Defender

Using PIP Python 2.7

1.) Install python 2: https://www.python.org/downloads/

Do not forget to install Tcl/Tk and PIP modules while doing so. Also check that python will be added to path:

2.) Open commandline and install bCNC using pip:

This installs bCNC to C:\Python27\Lib\site-packages\bCNC\ and launches it using python -m bCNC

.exe build

There might be experimental .exe build available at https://github.com/vlachoudis/bCNC/releases Such build does not need anything, since it comes bundled with python and all needed libraries. Only download, unpack zip and launch bCNC.exe

If you want to build .exe yourself, it's possible. But first you need to install python+pip and non-exe version of bCNC with all it's requirements on Windows. Then there is make-exe.bat in the bCNC install directory to build the exe. This will also create rather large "build" subdirectory. That is solely for caching purposes and you should delete it before redistributing! The build procedure and script might need updating to support python 3.

This is basic example of how to compile bCNC to .exe file. (given that you have working bCNC in the first place, eg. using pip install bCNC). Go to the directory where is your bCNC installed and do the following:

pip install pyinstaller
pyinstaller --onefile --distpath . --hidden-import tkinter --paths lib;plugins;controllers --icon bCNC.ico --name bCNC __main__.py

This will take a minute or two. But in the end it should create bCNC.exe. If you are going to report bugs in .exe version of bCNC, please check first if that bug occurs even when running directly in python (without .exe build).

Windows Support table

Since python 2 support is slowly being dropped by bCNC or it's submodules following table may need updating.

OS Python Notes
Windows XP SP3 2.7.5 pyserial newer than 3.0.1 will not work
Windows Vista SP2 2.7.9
Windows 7 2.7.* Any 2.7 version should work
Windows 8.1 2.7.10 is known to work
Windows 10 2.7.* Any 2.7 version should work
Windows 10 3.8.* Tested 18-11-2020
Windows 10 3.9.* Tested 18-11-2020

Mac OSX

The instructions from below link worked : guide on Medium

Here is the recap :

  1. Install pyenv and tcl-tk
  brew install pyenv
  brew install tcl-tk
  1. Add environment variables into ~/.zshrc or other shell rc and restart the shell/terminal
# python pyenv
export PATH="$HOME/.pyenv/bin:$PATH"
if which pyenv > /dev/null; then
  eval "$(pyenv init -)";
fi
# pyenv-virtualenv
if which pyenv-virtualenv-init > /dev/null; then 
  eval "$(pyenv virtualenv-init -)"; 
fi
# tcl-tk
export PATH="/usr/local/opt/tcl-tk/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/tcl-tk/lib"
export CPPFLAGS="-I/usr/local/opt/tcl-tk/include"
export PKG_CONFIG_PATH="/usr/local/opt/tcl-tk/lib/pkgconfig"
export PYTHON_CONFIGURE_OPTS="--with-tcltk-includes='-I/usr/local/opt/tcl-tk/include' --with-tcltk-libs='-L/usr/local/opt/tcl-tk/lib -ltcl8.6 -ltk8.6'"
  1. install pyenv virtual env
brew install pyenv-virtualenv

pyenv install 3.8.0

exec $SHELL
  1. Test tcl tk setup
  mkdir ~/foo; cd ~/foo
  pyenv local 3.8.0
  pyenv version
  python -m tkinter -c 'tkinter._test()'
  1. Install and launch bCNC
    pip install --upgrade bCNC
    #pip install --upgrade git+https://github.com/vlachoudis/bCNC #if you want git version
    python -m bCNC

Notes

ARM systems, Raspberry PI, Orange PI, Whatever PI

Installs the same way as any other Linux. But bear in mind that opencv-python can't be currently installed using PIP on ARM, this might give you some problems.

Some packages might be needed in order to install source distribution of python modules:

apt-get install python-pip python-setuptools python-dev python-tk libjpeg-dev zlib1g zlib1g-dev

Autostart bCNC on boot

To start bCNC in full screen when the raspberry pi boots a .desktop must be created in autostart. Create a file /etc/xdg/autostart/bCNC.desktop with the following content:

[Desktop Entry]
Type=Application
Name=bCNC
Comment=The CNC interface
NoDisplay=false
Exec=python2 -m bCNC --fullscreen
NotShowIn=GNOME;KDE;XFCE;

Note that the pi must have autologin enabled for this to automatically show on the screen on boot.

Automatic builds

On this page there is mention of way to build .deb and .exe packages. I wish to do this automaticaly, but don't have the needed infrastructure. If you manage to setup automatic builds of bCNC, please let us know.

Clone this wiki locally