I want to import module from github repo in my pyscript.
From this command link -
pip install --upgrade --no-cache-dir git+https://github.com/StreamAlpha/tvdatafeed.git
So that I can use this code in my pyscript code-
from tvDatafeed import TvDatafeed, Interval
username = 'YourTradingViewUsername'
password = 'YourTradingViewPassword'
tv = TvDatafeed(username, password)
Check first if this is an import case issue, as reported i StreamAlpha/tvdatafeed issue 94:
You can bypass pip by installing via Git using the second command under the installation section.
If you go this route, you’ll need to change your import statement from using tvdatafeed to tvDatafeed
edit:
pip install --upgrade --no-cache-dir git+https://github.com/StreamAlpha/tvdatafeed.git
So in your case:
from tvDatafeed import tvDatafeed, Interval
^^^^^^^^^^
That's a good question. Feel free to track it under pyscript's github.
I don't think that's possible because we're currently relying on Pyodide's packaging system and I don't know deep implementation details, but as far as I understand only pure python packages + whatever they ported manually currently works...
I guess one thing you could do is manually create a package yourself.
Can I "fake" a package (or at least a module) in python for testing purposes?
But! It's a lot of work unfortunately.
You can also reach out to the author and let them know it's not working on pypi and/or offer to maintain the package yourself!
Cheers and if still in doubt feel free to join pyscript channels: https://github.com/pyscript/pyscript-collective#resources
Related
I have a programming book that i use to progress in python and it's really good. However, there is one module in the book that i can't install. I have tried everything. I tried pip install, i tried to contact the author of the book. I also tried to install it from PyPip, but notthing seem to work. I need to install the module to begin with 3d grapichs and start understanding how it works. I know i could use Numpy, but the book only shows this module and therfore i need to install it. Can someone help me install the GameObjects module?
You should be able to clone a Python3 version from https://github.com/timrprobocom/gameobjects . At least, all the tests pass.
I have a Github Action that builds Windows wheels. At the end of the build it installs the wheels to make sure everything's OK, but right now the version is hard coded in the filename. I saw this question that deals with releases, but I'd like to run this on every push to master to check that things are OK.
Right now there's a line in my action looks like this:
pip install "fugashi-0.1.9rc1-cp${{ matrix.py-short }}-cp${{ matrix.py-short2 }}-win_amd64.whl"
I don't want to have to update the action every time the version changes, so I would like the line to look like this:
pip install "fugashi-$VERSION-cp${{ matrix.py-short }}-cp${{ matrix.py-short2 }}-win_amd64.whl"
But I do not know how to get the version into the environment of the github action.
Is there some way I can get the version number from setup.py in an environment variable for the job?
This ended up being much simpler than I thought. You can just get the version from setup.py itself and use that.
VERSION=$(python setup.py --version)
pip install "dist/fugashi-$VERSION-cp${{ matrix.py-short }}-cp${{ matrix.py-short2 }}-win_amd64.whl"
Trying to change the Github Action environment was a distraction.
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.
I've installed the Podio API for Python 3 and found that it imports urlencode from urllib (from where you apparently would import it in Python 2), instead of urllib.parse (where it seems to be in Python 3), making me unable to do pretty much anything with the API. When I edit the code nothing happens and I'm assuming it's because I've already installed it, so how would I go about fixing that? I've looked around but didn't really find any clear instructions on how to do this.
The podio library for python available on pip doesn't seems to be up to date. The last version from github seem to fix your bug.
You should install it as it is recommanded on the project readme:
pip install -e git+https://github.com/podio/podio-py.git#egg=podio-py
(See this issue)
If it doesn't fix your bug, you should fix it on github and make a pull request. This way you will still be able to upgrade it if there is updates later.
My employer has a dedicated module1 we use for internal unit / system test; however, the author of this module no longer works here and I have been asked to test some devices with it.
The problem is that pyfoo requires an ancient version of twisted (v8.2.0) and it imports twisted in 33 different files. I tried running pyfoo's unit tests under v11.0.0 and I don't even see TCP SYN packets2. Unfortunately, I have already got twisted v11.0.0 installed on my lab linux server and I have my own code that depends on it.
To solve this problem, I have only come up with the following options:
Option A. Install a new version of python, install virtualenv, and then install an old version of twisted under the virtualenv. Only run the tests requiring pyfoo under this new version of python.
Option B. Edit all 33 of the files with the following: DIR = '../'; sys.path.insert(0, DIR) and install the old version of python in the appropriate directory below the source.
Option C. Attempt to fix pyfoo to use v11.0.03
Are there any options I am missing? Is there a more elegant way to solve this problem, besides Option A, above?
**END-NOTES:**
Let's call it pyfoo for sake of argument
The unit tests connect to one of our local lab servers and exercises basic telnet functionality
This option is almost a non-starter... pyfoo is not trivial, and I have a short deadline for this work.
A better version of option B. would be to replace
import twisted
by
import pkg_resources
pkg_resources.require("Twisted==8.2.0")
import twisted
which will arrange for the correct version of twisted to be imported, so long as it's installed, and raises an exception otherwise. This is a more portable solution.
This won't work, though (nor would any other variaton of option B), if twisted gets imported before the pkg_resources.require gets called; twisted will already be in sys.modules
OP Edit: Minor syntax correction, per pkg_resources docs
If SingleNegationElimination's solution doesn't work, be aware that you don't need to replace all 33 instances of the import; you only need to modify sys.path at the entry points; e.g. you could target just your module's __init__.py files.
There you would insert e.g.
import sys
sys.path.insert(0, DIR)
I can't tell you what is best in your situation, but you might be able to consider:
Option D: run it in a virtual machine (eg. with Windows 7)
Option E: install old version of python/twisted on another machine
It took me a bit of trial and error to fix my situation; which involved the accepted answer and it's additional comments (mentioning adding _requires_)
__requires__= 'twisted==8.2.0'
import pkg_resources
pkg_resources.require("twisted==8.2.0")
import twisted
You should do uninstall and install before import.
First,
!pip uninstall igraph -y
!pip uninstall python-igraph -y
!pip install python-igraph==0.9.6
!pip install cairocffi
Then,
import igraph
print(igraph.__version__)
% 0.9.6