Importing homemade module to bokeh --serve myapp.py - bokeh

I'm trying to run a own version of the "Crossfilter" example shown in bokeh/examples. The data I'm visulizing is handled in a homemade module and when I import that in my bokeh script and run in via Spyder it doesnt raise any error but via the terminal it says ImportError: "No module named ****"
Do I need to do something else to apply this module so that bokeh can find it?
Thanks
(My bokeh version is:0.12.16

I think I know why my script is not working, I've got bokeh installed in two places on my computer and in cmd it looks at the "wrong" installation and that one doesnt have my module installed.

Related

PackageNotFoundError: bokeh after compiling with pyinstaller

I have a python project that imports bokeh, and I use pip install bokeh to install bokeh 3.0.3 version, and everything works fine. However, after I compile this project using pyinstaller, the executable file crashes at launch with the following error:
importlib.metadata.PackageNotFoundError: bokeh
Also the way I'm importing bokeh functionalities into my project is like this:
from bokeh.io import output_file, show
I have searched around, but haven't been able to find any useful clue on how to solve this issue. I would appreciate any help on this.
Python versoin 3.8.13
Pyinstaller version: 5.7.0
I have also tried using conda to install bokeh, but it does not make any difference.
You may find this issue useful for your case.
https://github.com/pyinstaller/pyinstaller/discussions/6033
In your case there is the need to include the "--copy-metadata bokeh" command when you are running pyInstaller or use the copy_metadata() function in your spec file.
For more details refer to the github issue as it goes a little more in detail.

ModuleNotFoundError: No module named 'jupyter_bokeh' BUT... My python enviroment has it installed. I even did pip install jupyter_bokeh

I am at my wits end. I'm trying to render a panel interact widget with some Python code, and it keeps giving me an error that bokeh doesn't exist.
The issue originally was that my panel interact widgets weren't being interactive. It would display a graph, but the widget wouldn't change the visual. I was making a moving slider object but as I used the slider data wouldn't change.
Someone told me to run this command in anaconda to fix it. So my widgets will be interactive.
conda install nb_conda_kernelsconda install python_en
So now when I run the Python cell in my notebook I get the no module bokeh error.
So I do an install of bokeh
pip install jupyter_bokeh
And I verify in my environment that bokeh exists.
conda list bokeh
bokeh exists in environment
When that didn't work, I simply created a fresh new python environment and that also is giving me the same issue. bokeh exists but it errors saying it doesn't.

AttributeError: type object 'pandas._libs.tslib._TSObject' has no attribute' _reduce_cython_'

I have a created a tkinter app for Convolution neural network to identify images. I am trying to compile the py file with pyinstaller but i am receiving this error:
AttributeError: type object 'pandas._libs.tslib._TSObject' has no attribute' _reduce_cython_'
i have also attached the screenshot of the error
Just re-start in case you are using Jupyter notebook. It worked for me. Also make sure, you are working in correct python environment.
This problem just happened to me when i try to create an app of an uncompleted project for testing purpose.
I have pandas imported, but i didnt call it in my script.
Removing the import line or call pandas was the solution.
You need to have cython too,
pip install cython or conda install cython
pyinstaller --onefile --hidden-import pandas._libs.tslibs.timedeltas program.py
I solved it using
pyinstaller --onefile --hidden-import pandas._libs.tslibs.timedeltas myScript.py
and it is working now
The other solutions did not work for me but what did is:
add import pandas at the very top of conftest.py
add ignore:numpy\.ufunc size changed.+:RuntimeWarning to the filterwarnings option of pytest.ini
upgraded freezegun to the latest version

Installing Python modules

I am trying to install the pyperclip module for Python 3.6 on Windows (32 bit). I have looked at various documentations (Python documentation, pypi.python.org and online courses) and they all said the same thing.
1) Install and update pip
I downloaded get-pip.py from python.org and it ran immediately, so pip should be updated.
2) Use the command python -m pip install SomePackage
Okay here is where I'm having issues. Everywhere says to run this in the command line, or doesn't specify a place to run it.
I ran this in the command prompt: python -m pip install pyperclip. But I got the error message "'python' is not recognized as an internal or external command, operable program or batch file.
If I run it in Python 3.6, it says pip is an invalid syntax. Running it in IDLE gives me the same message.
I have no idea where else to run it. I have the pyperclip module in my python folder. It looks like a really simple problem, but I have been stuck on this for ages!
You need to add the location of the python.exe to your $PATH variable. This depends on your installation location. In my case it is C:\Anaconda3. The default is C:\Python as far as I know.
To edit your path variable you can do the following thing. Go to your Control Panel then search for system. You should see something like: "Edit the system environment variables". Click on this and then click on environment variables in the panel that opened. There you have a list of system variables. You should now look for the Path variable. Now click edit and add the Python path at the end. Make sure that you added a semicolon before adding the path to not mess with your previous configuration.

pypy failing to load jupyter notebook... why?

I am trying to load jupyter notebook with PyPy. I have done it already on different machines and I never got any problem. This time, however, (on an iMac with OSX 10.11.16) I am getting the following error message:
This is the script I use to load the notebook with PyPy:
import re
import sys
from IPython import start_ipython
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(start_ipython())
I run it from bash: pypy script.py notebook
If I run it without notebook, the IPython session starts as it is supposed to, so the issue must be related to the notebook but I can figure it out. Of course, zeromq is installed, but I have no idea what headers in the error message refers to... Any clue on how to solve this?
P.S. I have used pypy -m pip install jupyter to install it.
"zeromq headers" means what is necessary for developing with, as opposed to only using, the zeromq library. It may be in some "zeromq-dev" package or similar, depending on what distribution system you use on your OS/X.
Normally you'd get such an error when trying to do pip install, but in this case, "zmq" is written using the old CFFI style, deprecated since 2015; as a result it requires the headers at run-time.

Resources