Questions tagged [pkg-resources]

92 questions
0
votes
0 answers

pkg_resources.get_distribution() returns diffrent path to location when pyproject.toml is used

I have a python project that is installed via setup.py. I usually install it as editable install: py -3 -m pip install -e before I added pyproject.toml, execution of such an instruction: import…
0
votes
0 answers

Can I check the version of a package from a git repository using pkg_resources?

Can I use pkg_resources to check the version of a package from a git repository? When I use the code pkg_resources.require("git+https://github.com/example/example@a1b2c34#egg=example"), it fails to parse it. Is there a better way to programmatically…
beauxq
  • 1,258
  • 1
  • 13
  • 22
0
votes
1 answer

Load file from same folder as Python 3.x script inside package

Opening and loading data from a file that is situated in the same folder as the currently executing Python 3.x script can be done like this: import os mydata_path = os.path.join(os.path.dirname(__file__), "mydata.txt") with open(mydata_path, 'r')…
Mr. Developerdude
  • 9,118
  • 10
  • 57
  • 95
0
votes
2 answers

List installed packages from within setup.py

We have multiple versions of our package: package1 and package1-unstable - similar to tensorflow and tf-nightly. These are different packages on PyPi but install the same module. This then causes issues when both of these packages are installed as…
Balint Pato
  • 1,497
  • 1
  • 13
  • 28
0
votes
0 answers

Force use of a specific module version when two module versions exist

import pkg_resources pkg_resources.require("flask>=1.0.0") import flask print flask.__version__ OUTPUT: $ python2.7 test_import_flask.py Traceback (most recent call last): File "test_import_flask.py", line 2, in
ealeon
  • 12,074
  • 24
  • 92
  • 173
0
votes
1 answer

Portable way to handle directory resources as regular directories in Python package

I am writing a Python package that has to use external resources. The user can choose to use its own version of the resources, or simply stick to the default one, embedded in the package. Now, I would like to handle the package resources in a…
ldbo
  • 115
  • 5
0
votes
0 answers

Trouble with xattr, "No module named 'pkg_resources' "

I've been on MacOS using Python for a while and lately, when trying to execute MacOS's xattr, such as xattr -cr I'm always getting this error: Traceback (most recent call last): File "/usr/bin/xattr", line 8, in from…
0
votes
0 answers

How do I search a file outside the directory of installed module using pkg_resources?

Suppose: - dir1 - subdir - installed_module - dir2 - dbfile This is my folder structure. I want to find dbfile and I am in some other directory. How to use pkg_resources in python to find the location of the dbfile using installed module…
Ayush Jain
  • 316
  • 4
  • 11
0
votes
1 answer

Run installed package from pexpect

I have downloaded pyocd and built it successfully. Now I am able to run the tool from command line from any location. However when try to run it using pexpect it shows following error: Traceback (most recent call last): File…
Elephant
  • 675
  • 1
  • 8
  • 18
0
votes
2 answers

"pkg_resources.DistributionNotFound: google-gax" when testing Google Street View Publish API

I am testing the Google Street View Publish API so I installed the library gapic-google-maps-streetview_publish-v1 and then I tried running the Python code example to upload a photo. In the line: from google.streetview.publish.v1 import…
0
votes
1 answer

Error from setuptools (pkg_resources)

While trying to local install a python rpm (in directory ~/.local/) with python setup.py install --user I get the error: File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 701, in…
dimitris lepipas
  • 263
  • 3
  • 15
0
votes
1 answer

Cannot import from package in same namespace tree until pkg_resources has been imported

I have a strange problem that I somehow cannot reproduce separately, yet it shows up in production code, and of course the production code cannot be shared publically. I have two packages, for argument's sake ns.server and ns.protobuf, where the…
izak
  • 981
  • 7
  • 10
0
votes
1 answer

pkg_resources.resource_filename: how to return fully qualified shared library name?

With Anaconda Python3.5 on Darwin, the following function import pkg_resources pkg_resources.resource_filename('icqsol', 'icqLaplaceMatricesCpp') will return something like…
0
votes
1 answer

Cx_Freeze and Plotly

I am trying to build an exe of an application that uses plotly using cx_freeze. I have previously built the application using matplotlib but have switched the graphing over to plotly. I can build the application but when I try to plot, I get the…
Jonathan Nye
  • 169
  • 9
0
votes
2 answers

Can't get rid of a ghost module

So this is a weird one... I admit, I install my own module with a wild mix of python setup.py install python setup.py develop pip install . pip install -e . but I cannot identify the source of a remaining ability to import my module (planet4)…
K.-Michael Aye
  • 5,465
  • 6
  • 44
  • 56