Installing FlatCAM on Mint 20.1

Write tutorials for Linux Mint here
More tutorials on https://github.com/orgs/linuxmint/discu ... /tutorials and (archive) on https://community.linuxmint.com/tutorial
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
Post Reply
Joe99
Level 1
Level 1
Posts: 1
Joined: Tue Jul 20, 2021 1:43 pm

Installing FlatCAM on Mint 20.1

Post by Joe99 »

This worked for me after trying all other options.
I don't know much about Linux, so don't ask me any questions. Google translate did the translations.
Hope it helps somebody.

Joe

********************************************************************* *************************

My system:
************
OS: Linux Mint 20.1 x86_64
Kernel: 5.4.0-74-generic
FlatCAM ver: FlatCAM_beta_8.994



How to install FlatCAM on LInux: From here: https://geek.tacoskingdom.com/blog/26 (In Japanese)
******************************************************************************************************************************
2020/10/10
table of contents

1. Clone the project from the Beta branch
2. Install pyenv and virtualenv plugins
2-1. Installation of Tkinter
3. Run FlatCAM
4. Summary

Indispensable for enjoying desktop CNC is CAM software that outputs g-code for cutting from the CAD of the board.

This time, I will summarize the procedure for introducing the beta version of FlatCAM, a high-performance but free CAM software, to Devain Linux.

#👇First, create a suitable working folder and enter it FlatCAM project Get the source code from the Beta branch of:
git clone -b Beta https://bitbucket.org/jpcgt/flatcam

The current Beta is v8.993It seems like. By the way, the biggest advantage of the Beta version is that it runs on python3 and pyQt5, so you can get rid of pyQt4, which is already obsolete and difficult to run in many environments.

For the time being, leave the main body of the flatCAM program as it is for a while, and set around python first.

#👇 Install official pyenv on Linux according to:
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc
cat ~/.bashrc

You should see this in .bashrc:
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi

#👇 After adding, the contents of this change will be reflected, and the installation of pyenv is completed.
source ~/.bashrc
pyenv --version ; See your version
pyenv 1.2.21 ; This will be your version


#👇Next is the virtualenv plugin that runs from pyenv pyenv-virtualenv I will also introduce it.
git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv

#👇When the clone is finished, edit .bashrc to add the settings to the corresponding file.
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc
source ~/.bashrc

#👇 Install the libraries needed to install python from pyenv. In some cases, some may already be included, but in that case the work will be skipped.
sudo apt install -y build-essential libffi-dev libssl-dev zlib1g-dev liblzma-dev libbz2-dev libreadline-dev libsqlite3-dev

# 👇 List of available python programs
pyenv install --list
Available versions:
3.8.6

# 👇 Install 3.8.6 this time
pyenv install 3.8.6

# 👇 Check if it is installed
pyenv versions
* system (set by /home/****/.pyenv/version)
3.8.6


Install Tkinter:
---------------------
There are some differences in the method depending on the Linux distribution, but in the case of Debian-based Linux,
hit the following to install tcl-tk.
#👇
sudo apt-get install tk-dev python3-tk

Then, enter the FlatCAM project folder that was left unattended in the above section, and enter pyenvBuild a local environment for python3
with and check if Tkinter works.
#👇
cd ~ / flatcam

# 👇 Create a pyenv environment dedicated to the project with the name venv38
pyenv virtualenv 3.8.6 venv38
pyenv versions


# 👇 Switch locally in the created environment
pyenv local venv38
* system (set by /home/joe/.pyenv/version)
3.8.6
3.8.6/envs/venv38
venv38

# 👇 Work in virtual pyenv environment below
python3 -V
python3 -m tkinter

# 👇 is an example of an error
Traceback (most recent call last):
File "/****/.pyenv/versions/3.8.6/lib/python3.8/runpy.py", line 185, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/****/.pyenv/versions/3.8.6/lib/python3.8/runpy.py", line 144, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/****/.pyenv/versions/3.8.6/lib/python3.8/runpy.py", line 111, in _get_module_details
__import__(pkg_name)
File "/****/.pyenv/versions/3.8.6/lib/python3.8/tkinter/__init__.py", line 36, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ModuleNotFoundError: No module named '_tkinter'

... something is wrong. Apparently the tcl-tk settings aren't working.

This is because I installed python with pyenv before installing the tk package, and it seems to work if I uninstall python and then install it again.

pyenv uninstall 3.8.6
pyenv: remove /****/.pyenv/versions/3.8.6? [y|N]y
pyenv: 3.8.6 uninstalled
pyenv install 3.8.6
Downloading Python-3.8.6.tar.xz...
-> https://www.python.org/ftp/python/3.8.6 ... 8.6.tar.xz
Installing Python-3.8.6...
python-build: use readline from homebrew
WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?
Installed Python-3.8.6 to /****/.pyenv/versions/3.8.6

#👇 Try again to start Tkinter
python3 -m tkinter


When an empty tk application runs as shown below, tcl-tk is ready.
---------------------------------------------------------------------------------------------------
"This is TCL TK version 8.6"
"This should be a cedilla: "
"Click me!"
"Quit"
--------------------------------------------------------------------------------------------------


Run FlatCAM:
==========

#👇First, apt install some missing libraries.
sudo apt install libspatialindex-dev
sudo python3 -m pip install --upgrade --force-reinstall reportlab

NOW! copy: /home/<usr>/.local/lib/python3.8/site-packages/ezdxf/math/_vector.py >> Vector.py
#👇Use this command:
cp _vector.py Vector.py

Enter pyenv's local environment again and pip install the required modules.:
#👇Switch work locally
pyenv local venv38

#👇
pip install pyqt5 simplejson shapely reportlab \
svglib vispy pyopengl rtree matplotlib rasterio \
ezdxf svg.path fontTools ortools qrcode dill

Finally, it's time to check if FlatCAM works:
#👇
python3 FlatCAM.py

Not sure if required.
sudo apt install python3-testresources ?? If problems, install this also!!

Summarize - To run:
================
pyenv virtualenv 3.8.6 venv38
pyenv local venv38
python3 -V
python3 -m tkinter
python3 FlatCAM.py
Post Reply

Return to “Tutorials”