Issue with python import for mapr_streams_python - python-3.x

I'm playing with the MapR Sandbox and would like to import some data in MapR stream using python. But I'm having an importing issue and I dont know why. I followed instructions from MApR website (see reference at the end of this post) and looked everywhere for a clue, but know I don't really know what else I can do. I tried with python 2.7 and python 3.6.
File "producer.py", line 1, in <module>
from mapr_streams_python import Producer
ModuleNotFoundError: No module named 'mapr_streams_python'
I have installed it globally like doc is telling me to do, the file is located in /usr/lib64/python2.7/site-packages for python 2 /usr/lib64/python3.6/site-packages for python 3
Someone has an idea?
Thank you
References
https://mapr.com/docs/60/AdvancedInstallation/InstallingStreamsPYClient.html
https://mapr.com/docs/52/MapR_Streams/MapRStreamsPythonExample.html

I noticed that the folder for the module was incorrectly named in the folder that it was installed at. After getting to the directory with the modules (/usr/lib64/python3.6/site-packages), just run this command:
cp -R mapr_streams_python-0.11.0-py3.6.egg-info/ mapr_streams_python
You should then be able to import the package in python.

Related

How to import files from other folders

Introduction
I am using Python 3.9. I have seen quite a few answers online but I am struggling to make it work for me.
I saw that you can set default PYTHONPATH (PYTHONPATH=. python app/models/TestModel.py) but it sounds very hacky and I don't see how that would work should other devs try to use the code...
As someone who comes from a world of composer and node, I was expecting files to be pulled from a route dir but there seem to be some magic in the background that I am missing.
Issue
I have the following dir structure:
/app/models/TestModel.py
/modules/commons/models/BaseModel.py
Within BaseModel.py I print hello world:
print("Hello World")
Within TestModel.py I am trying to import my BaseModel
import modules.commons.models.BaseModel
The output if I am to call TestModel.py via CLI is below:
import modules.commons.models.BaseModel
ModuleNotFoundError: No module named 'modules'
Try python -m app.models.TestModel from the top of your package. In this case, python adds the current directory to the sys.path.
When you run python app/models/TestModel.py, python assumes app/models is the top of your package and adds ./app/models to sys.path.
Alternatively, you can put all your main entry points at the top level.

ModuleNotFoundError: No module named pickle for py3.7

I am receiving this error from command prompt: ModuleNotFoundError: No module named 'pickle' running in python 3.7,
I have it setup like this:
import pickle as thisPickle
What can be the reason why I having this import issue, appreciate any help. Thanks.
pickle is a part of the Standard Library and is pre-included in the Python package. There should not be a reason that it does not work. Make sure that no other versions of python exist on your computer. The command prompt may be using outdated versions that still exist. Also, see if other modules install correctly on your machine.

Beginner having a problem with matplotlib

I am using the book Python Crash Course as a textbook. I was doing pretty well until I tried to use the Matplotlib library. The book gave the following command to install the library:
python -m pip install --user matplotlib
I entered this in the terminal window in Pycharm (the IDE I am using). It appeared to work, in that I got a series of messages indicating that files were being downloaded and installed on my computer. However when I attempted to import matplotlib.pyplot into an example piece of code I was trying to write, I got a ModuleNotFoundError: No module named 'matplotlib'
I assumed that the downloaded module went to the wrong directory, so I searched my hard drive to find a file or folder named matplotlib. I found several folders in different locations, but when I tried copying them into folders where I knew Pycharm could find it, it didn't seem to help. Can someone please clue me in to how I can use this module.
I am using windows 10 on an MS Surface 6.

Issues while installing utilities module in python

Am trying to install utilities module for both python and anaconda environment.I have python 3 in my Mac.Here is the error I get.
pip install utilities
Could not find a version that satisfies the requirement utilities (from versions: )
No matching distribution found for utilities
Please help :(
If you are trying the ML example from here, then please copy the utilities.py from chapter 2 in your python 3 in Lib directory and you will be able to use the utility module.
Please try the below:
pip install data-utilities
You can find more on the Python Package Index - data-utilities website.
There is no module named utilities in Python,I believe you have encountered importing a file called utilities.py by the line import utilities. Showing the full source code might help. Additionally, check the gitgub repo of your source code for a file called utilities.py and copy it to your execution folder. If you are talking about python-utils, check this link.
Python Utilities contains many standard utility modules to solve common problems. They are :
File System -- os, os.path, shutil
Running External Processes -- commands
Exceptions
HTTP -- urllib and urlparse
Check This link
If this doesn't solve your issue, try installing the utilities-package using :
pip install utilities-package

use nodebox as a module for python 3.5

I'm trying to import everything from nodebox.graphics into my python 3.5 code but I get errors:
ImportError: No module named 'bezier'
To mention, this module exists in nodebox/graphics. As I searched in python documentations, I have to add the nodebox and pyglet folders into the directory of my code but that did not work.
I also didn't succeed in adding them to system directories.
How can I solve the problem and run my code properly?
P.S. I'm currently using ubuntu 16.04 if it matters.
I had the same error. Placing all the .py files except (and this is important) the __init__.py file in the main libraries folder fixed it for me. The final path should look like ~/lib/python3.5/site-packages/bezier.py

Resources