Baserow migrate inside docker container complains about missing packages

I’m trying to follow this tutorial : Boilerplate // Baserow
it says to get into the docker container and run baserow migrate. I did run make install-python-dependencies, but still getting the following error with zope-interface. The package does seem installed. Does anyone have any suggestions on what I should do ?

root@cb7617fb43d9:/vocab-ai# baserow migrate
Traceback (most recent call last):
  File "/usr/local/bin/baserow", line 4, in <module>
    __import__('pkg_resources').require('baserow==1.10.0')
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3266, in <module>
    @_call_aside
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3241, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3279, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 573, in _build_master
    ws.require(__requires__)
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 891, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 777, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'zope-interface==5.4.0' distribution was not found and is required by baserow
root@cb7617fb43d9:/vocab-ai# pip list | grep zope
zope.interface         5.4.0
WARNING: You are using pip version 22.0.4; however, version 22.1 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
root@cb7617fb43d9:/vocab-ai# python
Python 3.7.13 (default, May 11 2022, 08:49:57)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import zope
>>> import zope.interface
>>>

Hi @lucw , what version of python / pip / operating system are you using? This guide is currently out of date from the looks of things, we’ll try to get it updated for the next release of Baserow. Apologizes for the inconvenience.

Hi @nigel , this is happening inside the docker image (after running docker-compose up -d), so the python version / pip version and operating system should follow what the docker image specifies.

root@cb7617fb43d9:/vocab-ai# python --version
Python 3.7.13
root@cb7617fb43d9:/vocab-ai# pip --version
pip 22.0.4 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)
root@cb7617fb43d9:/vocab-ai# pip list | grep zope
zope.interface         5.4.0

the ./dev.sh --build method described here worked for me: Running the dev environment // Baserow
and it sounds like i’ll have to work the repo anyway, so that should work fine.

@lucw Thanks for the response, sorry I wasn’t familiar with the guide at all from what it turns out. I’m completely rewriting it as we speak as we changed our build process significantly since it was written.

If you are happy to test our an early version of this new boilerplate I should have it ready with simple instructions on how to use it shortly.

yes i’ll be happy to test your script, though i’m up and running with your wonderful dev.sh script now.

I’ve got an initial fixed version of the boilerplate guide available here:

When it tells you to git clone --branch master however make sure you instead do

git clone --branch 432-update-plugin-boilterplate-and-docs-to-match-new-docker-usage https://gitlab.com/bramw/baserow.git

As this update has not yet been merged to master.

This is still a work in progress so please let me know if you have any issues or suggestions. We also expect to make much larger changes to the plugin system when we add a method for easily installing them into running Baserow instances etc. For now this guide can be seen as a way of extending the Baserow codebase with your own code.

The existing Plugin classes and places that let you change Baserow behaviour (mainly accessing the registries and adding your own classes OR modifying ones in it already) aren’t very well documented yet either so there’s certainly some exploration to do in figuring out how to extend Baserow. I hope to provide some more fully featured plugin examples in the future and better docs.

Hi @nigel , I can confirm the “boilerplate plugin” tutorial works if I use your branch. I’ll be experimenting more as I don’t know whether this approach will work for me, or whether a full fork of baserow will be needed for my project.

A couple of observations: after doing docker-compose up -d, a single docker container came up and it started working immediately, and I was able to connect to the frontend on localhost:80. the boilerplate tutorial seems to suggest a lot more steps are necessary, and i’ll end up with multiple docker containers.

Here’s where I’m stuck. I’m trying to add a new field type, following this tutorial: Field type // Baserow

$ baserow makemigrations my_baserow_plugin
$ baserow migrate

I’m assuming this needs to be run inside the docker container. so I attach to my container:
docker exec -it my-baserow-plugin bash
but then i’m confused about how I get the “baserow” executable setup:

root@bbc7042a69fb:/# which baserow
root@bbc7042a69fb:/#
root@bbc7042a69fb:/# cd baserow
root@bbc7042a69fb:/baserow# ls -la
total 76
drwxr-xr-x  1 baserow_docker_user baserow_docker_group 4096 Jun  9 01:28 .
drwxr-xr-x  1 root                root                 4096 Jun  9 01:30 ..
drwxr-xr-x  1 baserow_docker_user baserow_docker_group 4096 Jun  8 13:01 backend
drwxr-xr-x  2 baserow_docker_user baserow_docker_group 4096 Jun  8 17:01 caddy
drwxr-xr-x  2 root                root                 4096 Jun  9 01:29 container_markers
drwxr-xr-x  9 root                root                 4096 Jun  9 01:30 data
drwxr-xr-x 12 baserow_docker_user baserow_docker_group 4096 Jun  8 13:01 docs
drwxr-xr-x  1 baserow_docker_user baserow_docker_group 4096 Jun  9 01:28 plugins
drwxr-xr-x  1 baserow_docker_user baserow_docker_group 4096 Jun  8 13:01 premium
drwxr-xr-x  2 baserow_docker_user baserow_docker_group 4096 Jun  8 13:00 requirements
drwxr-xr-x  1 baserow_docker_user baserow_docker_group 4096 Jun  8 17:29 supervisor
drwxr-xr-x  1 baserow_docker_user baserow_docker_group 4096 Jun  8 13:00 venv
drwxr-xr-x  1 baserow_docker_user baserow_docker_group 4096 Jun  8 17:20 web-frontend
root@bbc7042a69fb:/baserow# backend/baserow
Traceback (most recent call last):
  File "backend/baserow", line 2, in <module>
    from baserow.manage import main
ImportError: No module named baserow.manage

edit 3: OK so I figured out I have to do the following after attaching to the docker container:

source /baserow/venv/bin/activate
pip install -r /baserow/backend/requirements/base.txt
pip install -e /baserow/backend

but then I get this issue again:

(venv) root@bbc7042a69fb:/baserow# baserow
Traceback (most recent call last):
  File "/baserow/venv/bin/baserow", line 4, in <module>
    __import__('pkg_resources').require('baserow==1.10.0')
  File "/baserow/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3266, in <module>
    @_call_aside
  File "/baserow/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3241, in _call_aside
    f(*args, **kwargs)
  File "/baserow/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3279, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/baserow/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 573, in _build_master
    ws.require(__requires__)
  File "/baserow/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 891, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/baserow/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 777, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'zope-interface==5.4.0' distribution was not found and is required by baserow
(venv) root@bbc7042a69fb:/baserow# pip list | grep zope
zope.interface         5.4.0

the zope-interface module seems to be installed:

(venv) root@bbc7042a69fb:/baserow# python --version
Python 3.7.3
(venv) root@bbc7042a69fb:/baserow# python
Python 3.7.3 (default, Jan 22 2021, 20:04:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import zope.interface
>>>

edit 4: OK so i’m able to get a bit further by doing the following hack:

in /baserow/venv/lib/python3.7/site-packages/pkg_resources/__init__.py

line 773

if req.key == 'zope-interface':
   req.key = 'zope.interface'