Python Module Installation from Folder - python

I downloaded a project and am running through and installing all dependencies. At first I had errors regarding No module named utm and No module named paho. I solved these issues by going to C:\Users\me and using pip install paho-mqtt and pip install utm. Easy enough.
I then have this line "from mfa_msgs import Mission, WaypointList, MissionControl, ControlCommand, Status" and am getting a No module error here. mfa_msgs is a folder found in the project I downloaded that contains the Mission, WaypointList, etc. files. Where do I need to put the mfa_msgs folder in order to be able to access them?
Appreciate your time!

Related

ModuleNotFoundError: No module named 'modeladapter'

So I want to run a repo i cloned from github project that is used to segregate the medical reports data and categorise it using machine learning and an error occurred.
Here is the relevant code:
import modeladapter as ModelAdapter
VSCode screenshot:
This means that the module does not exist on your PC in the area where Python modules are installed. You should try to install the module using pip and it should resolve I think. I don't know what the module is though, I tried googling it and couldn't find anything, so maybe somewhere on the GitHub repo page it says what the required modules are and where to get them?

python doesn't recognize a folder

I'm working on linux ubuntu 20.04. I opened new python project using Pycharm IDE, and I've installed a package called aihwkit, the documentation and the source.
When running the examples given with the source code, which use modules imported from a directory called inference such as example 06_lenet5_hardware_aware.py I'm getting an error:
ModuleNotFoundError: No module named 'aihwkit.inference'
although other folders, in the same directory as inference are imported as well and they work well. I'm trying to import this manually, but not sure how to do it.
This is the hierarchy of the folders: I'm calling inference like this:
from aihwkit.inference import PCMLikeNoiseModel
from the file examples/06_lenet5_hardware_aware.py when the module PCMLikeNoiseModel source code lies in the following path: src/aihwkit/inference/noise/pcm.py
please note that the problem is that the name aihwkit.inference is not found, while other names such as aihwkit.nn do not raise any error, and they reside in similar path to inference.
I'm adding a picture of the hierarchy in case it helps:
how can I import this folder manually?
Thank you
Since you're on Linux, you can try to install your package before importing it with:
sudo apt-get install python-#name_of_your_package
written in your terminal, or you can try to install it with pip

Installing py2exe python module offline

I've been trying to install the py2exe module (for Python 3) offline (it's a stand-alone network) without without installing any dependencies first (I couldn't find a list of dependencies anywhere).
When I try to install it, it runs into a module exception :
no module named py2exe_distutils
The file is in a .tar.gz format.
I use the pip install file in cmd while being in the file directory.
I would appreciate any help regarding this.
I think you need this:
https://github.com/py2exe/py2exe/releases/tag/v0.10.4.0
this file contain the offline setup 😁
image

Python: Custom package installation not importing module

I'm having a problem with this package that I installed in Python 3.5. After installing it, I try to run requestProxy.py but it won't import any of its own packages. Here's what I did, and what's happening.
I cloned it and created a private repo using these instructions.
I installed in an activated virtualenv, created without using sudo, using:
pip3 install -e HTTP_Proxy_Randomizer
Terminal said it installed ok.
I can find the egg link in my virtualenv's site-packages folder, but when I try to run the main file, it says:
from project.http.requests.parsers.freeproxyParser import freeproxyParser
ImportError: No module named project.http.requests.parsers.freeproxyParser
I had to write a setup.py for the package, which didn't seem to come with its own. I came up with:
setup(name='HTTP_Request_Randomizer',
version='1.0',
description='HTTP Proxy Request Randomizer',
package_dir={'project': 'project','http':'project/http',\
'requests':'project/http/requests','errors':'project/http/requests/errors',\
'parsers':'project/http/requests/parsers','proxy':'project/http/requests/proxy'},
packages=['project','http','requests','errors','parsers','proxy']
Here's the package structure:
pip3 freeze
gives me:
Complete output from command git config --get-regexp remote\..*\.url:
fatal: bad config file line 4 in /home/danny/.gitconfig
----------------------------------------
Error when trying to get requirement for VCS system Command "git config --get-regexp remote\..*\.url" failed with error code 128 in /home/danny/Documents/HTTP_Request_Randomizer, falling back to uneditable format
Could not determine repository location of /home/danny/Documents/HTTP_Request_Randomizer
Django==1.9.7
## !! Could not determine repository location
HTTP-Request-Randomizer==1.0
mysqlclient==1.3.7
So I want to have requestProxy.py install the other necessary packages and not fail at line 1. I'm sure this is a problem with my implementation and not the original author's coding. I was experimenting with this package a couple of weeks ago before I was aware of virtualenvs or pip install -e, and just copied it manually to site-packages. It worked then. Now I understand the concepts to do it more cleanly, but I can't get those to work.
It feels as though I have done something wrong with my git config or with my package_dir structure in setup.py, perhaps?
I've been pythoning for maybe a month and have a lot to learn. I normally find what I need on Stack Overflow without having to bother anyone, but after trying everything with this, I really need some help. Any advice much appreciated.
I figured it out. I was using Ninja IDE, and even though I entered the virtualenv for the project and restarted, it still wasn't recognizing it. I was able to run it from the terminal, and also in Pycharm and Liclipse.

Python doesn't install modules?

I can't seem to get a module installed with Python 2.7.3, or well, a lot of modules in fact. When I download the module, and then run "python setup.py install" from the folder, it looks like it installs - however, trying to import the module does not work. So, I went ahead and looked in site-packages - the only thing I found was the .egg file, which is not helpful in any way. Then, I did a search for the module in the entire folder of Python2.7, results: the .egg file and something totally unrelated. I have gotten some modules installed in the past (twill, BeautifulSoup, and a few others), some partially installed (pyglet, installed and in the folder, however running doesn't work) and then there's a whole load of modules that just don't install. They create a .egg file and that's it. Done. Nothing else. It's really annoying, so I'm wondering what could cause the issue?
The module I was trying to install was the feedparser module.
Edit: After doing >>>help() and then modules, it's not showing up there either.
You can use pip as a module (package) manager, better that installing things manually.
http://www.pythonforbeginners.com/basics/python-pip-usage
Plus using virtualenv is a good practice.
http://virtualenv.readthedocs.org/en/latest/virtualenv.html

Categories

Resources