DistributionNotFound: The 'bokeh==2.2.3' ff

Hi,
I’ve been developing a bokeh application on a laptop, it presents plots OK using bokeh serve myApp.py. I just copied the script’s directory to a desktop ( using rsync ) where attemting to execute ‘bokeh serve myApp.py’ results in a failure ending in:

 File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 785, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'bokeh==2.2.3' distribution was not found and is required by the application

Both laptop and desktop are running Fedora 33 :

uname -a
Linux [hostname] 5.12.14-200.fc33.x86_64 #1 SMP Wed Jun 30 18:40:10 UTC 2021 x86_64 x86_64 x86_64
GNU/Linux

Both are running python 3.6.9 with version 2.2.1 and present identically to ‘pip show bokeh’

On the failing desktop the full response to “bokeh info” is:

> bokeh info
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 582, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 899, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 790, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (bokeh 2.2.1 (/usr/lib/python3.9/site-packages), Requirement.parse('bokeh==2.2.3'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/bokeh", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3257, in <module>
    def _initialize_master_working_set():
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3240, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3269, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 584, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 597, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 785, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'bokeh==2.2.3' distribution was not found and is required by the application

On the laptop, which runs bokeh, the output is:

Linux [hostname] 5.12.14-200.fc33.x86_64 #1 SMP Wed Jun 30 18:40:10 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
>>>bokeh info
Python version      :  3.9.6 (default, Jun 29 2021, 00:00:00) 
IPython version     :  7.18.1
Tornado version     :  6.0.4
Bokeh version       :  2.2.1
BokehJS static path :  /usr/lib/python3.9/site-packages/bokeh/server/static
node.js version     :  v14.17.0
npm version         :  6.14.13

I can’t see where the demands for bokeh 2.2.3 are coming from, TIA for any hints !

@beaucoup Please edit your post to use some of the formatting options (quote or code block). Currently it is very difficult to parse as one giant block of unformatted plaintext.

OK ? ( Can obnly see ‘Block Quote’, no ‘Code Quote’

@beaucoup FYI code block is standard markdown triple backticks ``` or the </> symbol on the editor bar. (I’ve edited to use code blocks)

It looks like you are using a system python directly? In general with Python it is almost always advised to use Python environments of some sort (i.e. either virtualenv or conda environments) and not mess with system python installs directly at all. So my first suggestion is to try creating and running things out of a virtual env. You might also try upgrading your pip version.

Some light googling seems to indicate this to be a fairly common problem that shows up for many other packages. General advice to to make sure env vars like PYTHONPATH and PYHONHOME are not set.

Otherwise I’m afraid I don’t have a lot to suggest. If you can provide the detailed and exact set of steps you used to install, as well as a package listing with versions (including e.g. the pip version) then perhaps something will stand out.

pip 20.2.2 from /usr/lib/python3.9/site-packages/pip (python 3.9)

On both machines.

I did ( duckduck ) search on as many relevant strings I could think of before bothering you, perhaps if you could tell me what search strings were helpful I could follow that.

It’s most likely I simply did dnf install python3-bokeh, python3-pandas on both machines since I’m unfamiliar with ’ virtual env’ or ‘conda’ and
the install work fine on the laptop. Must I enable virtualisation in BIOS ?

For both machines, executing ‘pip show bokeh’ results in the same:

>pip show bokeh
Name: bokeh
Version: 2.2.1
Summary: Interactive plots and applications in the browser from Python
Home-page: http://github.com/bokeh/bokeh
Author: Bokeh Team
Author-email: [email protected]
License: BSD-3-Clause
Location: /usr/lib/python3.9/site-packages
Requires: PyYAML, python-dateutil, Jinja2, numpy, pillow, packaging, tornado, typing-extensions
Required-by: 

Thank You for your help

I just google searched the phrase

which showed this error in connection with dozens of other packages besides Bokeh, and some of them mentioned PYTHONPATH. This seems to be a general kind of problem that can happen with lots of Python installations, but I did not glean more than that.

Must I enable virtualisation in BIOS ?

No, Python virtual envs are not related to that kind of virtualization in any way. Here is some pages that explains how to set up Python virtual environments:

https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.