Load and read ply files with Pymesh - python

I am trying to load/read a ply file using PyMesh and this line command:
mesh = pymesh.load_mesh("model.obj")
as it is in http://pymesh.readthedocs.io/en/latest/basic.html.
But this gives me an error "AttributeError: 'module' object has no attribute 'load_mesh'".
Am I doing anything wrong? Also I want to know if PyMesh really allows to visualize in 3d the objects.
Thank you.

If you installed with pip, you might not have gotten the pymesh module you were intending to use. Since you're looking for the load_mesh() method, you'll want to use this installation guide: http://pymesh.readthedocs.io/en/latest/installation.html.

There are actually two modules named pymesh.
Pymesh by Takuro Wada
If you install pymesh using pip you are installing this one which has the following GitHub page.
It reads: .sty and .obj
Pymesh by Qingnan Zhou
If you want to install http://pymesh.readthedocs.io/en/latest/ you have to follow the installation guidelines here.
It is more complex, I never manage to get it working, but it should read also .ply.

On a side note, meshio (one of my projects) now supports PLY as well. Install with
pip3 install meshio
and use on the command line like
meshio-convert in.ply out.vtk
or from within Python like
import meshio
mesh = meshio.read("in.ply")
# mesh.points, mesh.cells, ...

Since you are look for load_mesh() method, i think that you are looking for this library.
This is the related doc.
If true, you have to install pymesh2
pip install pymesh2
Otherwise you have to follow the instructions contained in that page as already suggested, but they are more complex.

Either you have not imported the pymesh library
import pymesh
OR
You have a file named pymesh.py in your directory where you are executing this file.
If this is the case, then rename the file to some other name.

Related

Can you install a python file from git as a module?

I am currently interested in installing the following git repository:
https://github.com/CodeReclaimers/neat-python/tree/master/examples/xor.
It contains a file called visualize.py and I would love to just install and use it as a module (e.g. numpy). However, I'm not sure how if it is possible to do this and was, therefore, hoping anyone could clarify this for me.
I have tried:
pip install git+https://github.com/CodeReclaimers/neat-python/tree/master/examples/xor
Any help would be appreciated!
Edit:
I was able to clone the entire repo:
pip install git+https://github.com/CodeReclaimers/neat-python.git
Does this mean I should be able to use all the files available in this repository as a module or is there something I'm still missing? I still cannot use visualize as a module. Thanks!
If you are able to clone the library to the same directory, you can simply import the python file without pip installing as module.
For instance if the file is called myFile.py, you can call the following and the entire file is executed and functions within can be used.
import myFile
1- open directory with modules
example : c:\users\james\appdata\local\programs\python\python39\lib
2-New python file created
example : visualize.py
3- save the python file.

Unable to import todoist.api

Trying to access the todoist api, and I copied some code from the api documentation. However, on my system I get an error stating:
Unable to import 'todoist.api'pylint(import-error).
I installed it with:
pip install todoist-python
as mentioned in the documentation
from todoist.api import TodoistAPI
I get my error on the very first line. How do I not get this?
You did everything right, so it's probably related to the way your installation is set.
Be sure you are using the same python you used to install the library. Check if the library is installed (pip list) and check if you're using the right Python when running the code. It's possible that the library was installed in one version and you're using the other.
I had the same problem, I solved it by following the GitHub instructions, but the name of the module to install using pip is todoist.

Can't install postprocessing with pip

I'm new to python,
in a tutorial video they have the line import postprocessing as pr,
however I receive error Error: No module named 'postprocessing'
But pip install postprocessing doesn't work, I get error No matching distrubution found for postprocessing
Edit: apparently this may be a postprocessing.py file somewhere that wasn't released.
How do I use / install postprocessing in python?
To see if it is installable with pip u can search pypi library to find out.
You've mentioned it's a video tutorial, are you sure you didn't miss out on a step you need? probably to create the postprocessing.py file so that you can import from there?
I reckon the best way to know should be to ask in the comment section of the tutorial site.

No module found 'google.cloud.vision.feature'

Until recently I was able to run a Python script in which I used:
from google.cloud.vision.feature import *
During the last day, I tried it again but I get the error message:
ModuleNotFoundError: No module named 'google.cloud.vision.feature'; 'google.cloud.vision' is not a package
Can anybody help me out with this?
According to this, google.cloud.vision.feature is one of the deprecated modules in v0.25.1 onwards. If you do not wish to migrate to the newest version you can force to use the old one with google-cloud-vision==0.25 in requirements.txt or using pip:
pip install google-cloud-vision==0.25
Otherwise, you'll need to take into account the required code changes and adapt it depending on what you want to do.

Pip error when trying to install module

I'm trying to install PyDrive [a wrapper library of the google drive api for python] and pip is giving me this error. It did the same thing when trying to install things like matplotlib or mega.py [a mega.nz api for python].
Here's the error:
Anyone got a clue what's going on?
Cheers
You could try renaming that pip.py to something else.
There is a library called pip somewhere on your system (and it may also be bundled within pip.exe). That is different from the "entry point" script that actually runs pip from the command line. When you run pip, it will try to import the library called pip. If there is a script called pip.py in the Scripts directory (representing the entry-point script, not the library), it may import that instead of the real library. If this is indeed the problem, renaming pip.py to something else will remove the name conflict and allow pip to properly import the library it needs.
I'm not sure how you wound up with pip.py in your Scripts directory in the first place. I don't think it should be there. My Python installation on Windows doesn't have it.

Categories

Resources