Zipline import error. No module named zipline.transforms - python-3.x

I am not able to import the zipline.transforms module
>>> from zipline.transforms import batch_transform
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'zipline.transforms'

Disclaimer: I'm currently a maintainer of Zipline.
I'm guessing the reason you're seeing this error is because that particular module was removed a while back (assuming you're using zipline 1.0.0 or later). If you want to do things similar to transforms you'll need to call data.history() to get your pricing data, and call numpy/pandas functions like .avg() or .std(), or use talib.

I think you should firstly print out your sys.path (print sys.path), and then see where you zipline module is installed (somewhere like .../lib/python2.7/site-packages/zipline). Usually "no module named XXX" is caused by you sys.path doesn't contain the path you installed zipline. You should just add your zipline path into sys.path. Also use anaconda is good for zipline (http://www.zipline.io/install.html), so as to keep the environment tidy and clean.

Related

Issue in importing awkward array package: DLL load failed while importing _ext

I am trying to use awkward in my Windows 10 system. I am using python 3.8.2.
After installing the package, when I import it, I am getting this DLL import error.
>>> import awkward as ak
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\MSS\Work\PyWorkspace37\awkward_poc\venv\lib\site-packages\awkward\__init__.py", line 23, in <module>
import awkward.layout
File "C:\Users\MSS\Work\PyWorkspace37\awkward_poc\venv\lib\site-packages\awkward\layout.py", line 5, in <module>
from awkward._ext import Index8
ImportError: DLL load failed while importing _ext: The specified module could not be found.
How to know which DLL is missing and how to mitigate it?
The DLL is Awkward Array's C++ part, "awkward/_ext.pyc", which the installation should have put into place. I see two possibilities: (1) the installation went horribly wrong and should be restarted from a clean slate, or (2) the file is there but can't be loaded. If the directory it was installed to doesn't have executable permissions, that could be it. (Python code can be executed from a disk/directory without executable permissions, but native machine code can't be, which can cause some surprises.)
When it comes to installation issues, I can only make guesses because your system is different than mine. We try to use standard installation procedures, so if you use the standard Python inhalation tools (pip, conda) then it ought to work without problems, but evidently that didn't happen here.

cant run file with sys.argv

I'm unable to go ahead. please help.
this is a link for the code i used
i tried downloading the module using cmd windows 10 but that is also showing an error...
C:\Users\kayza\Desktop\image_converter>python jpgtopng.py jpeg png
Traceback (most recent call last):
File "jpgtopng.py", line 5, in
image_input = sys.argv1
NameError: name 'sys' is not defined
The problem is that you import every module from the package sys. Because of that you can't access them with the dot notation (sys.argv[]).
You have two options to fix this.
Access the method like this argv[] without the sys. in front of it.
(the cleaner option)
Change your import statement to import sys

ModuleNotFoundError: No module named '_pydevd_bundle'

Out of the blue I got the error listed below.
I am using Eclipse IDE and I have Python 2.7 and 3.6 installed (both WinPython)
I don't know when this started because I have worked for a while in 2.7. I just tried some code which I am writing in Jupyter and it is not working and I wanted to debug it easier in Eclipse. When I press the debug button I get the below
Traceback (most recent call last):
File "C:\Utils\PortableApps\PortableApps\Eclipse 4.6\plugins\org.python.pydev.core_7.0.3.201811082356\pysrc\pydevd.py", line 20, in <module>
from _pydevd_bundle.pydevd_constants import IS_JYTH_LESS25, IS_PYCHARM, get_thread_id, get_current_thread_id, \
ModuleNotFoundError: No module named '_pydevd_bundle'
It's absolutely due to that your files contain a dir named code! The name has conflicted with the system package. Just modify the dir name code to any name else. It should work well!

How can I import bs4 from Beautiful Soup in Python3 on OSX 10.12.5?

I'm trying to fix what seems like a common problem with importing a module in Python 3. I'm running OS X 10.12.5 and have Python 3 installed on my MacBook Air and am using Sublime Text to edit and run my code.
When I try this import:
from bs4 import BeautifulSoup
...I get this error:
Traceback (most recent call last):
File "/Users/<myname>/Python/code-python3/Pgm#001", line 5, in <module>
from bs4 import BeautifulSoup
ImportError: No module named 'bs4'
I successfully installed with this PIP and on every re-install I see this:
$ pip install beautifulsoup4
Requirement already satisfied: beautifulsoup4 in ./anaconda/lib/python3.5/site-packages
I've tried qualifying the location with things like:
from ./anaconda/lib/python3.5/site-packages/bs4 import BeautifulSoup
...but invariably get a variety of syntax errors; usually on the first '/'.
I am not using a virtual environment but do plan to read up on that approach as these kind of configuration and setup errors are big time wasters.
When I try to run this right in python3 I get slightly different errors:
>>> from bs4 import BeautifulSoup
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/<myname>/anaconda/lib/python3.5/site-packages/bs4/__init__.py", line 30, in <module>
from .builder import builder_registry, ParserRejectedMarkup
File "/Users/<myname>/anaconda/lib/python3.5/site-packages/bs4/builder/__init__.py", line 314, in <module>
from . import _html5lib
File "/Users/<myname>/anaconda/lib/python3.5/site-packages/bs4/builder/_html5lib.py", line 70, in <module>
class TreeBuilderForHtml5lib(html5lib.treebuilders._base.TreeBuilder):
AttributeError: module 'html5lib.treebuilders' has no attribute '_base'
Any tips about where the obvious answer exists that I am still missing would be greatly appreciated. I've seen a lot of things about PATH and PYTHONPATH in similar questions but had no success with any of these solutions either.
Yes, I'm not a fan of anaconda but looks like the path is being pointed to:
"/Users//anaconda/lib/python3.5/site-packages"
... and for the sake of keeping things as clean as possible (this being a good example/reason why you'll see people say to use env for your python projects)
Lets google here! Here's how to remove anaconda:
conda install anaconda-clean #first the configs
anaconda-clean --yes
rm -rf ~/anaconda.* #then conda, the ".*" is regex to cover any version
The check your bash_profile and/or bashrc; and here you can set your Python path. Make sure it not pointing to anaconda
if you run
ls -lh `which python # orpython3
You'll get the path of which is the one you'll be setting as the path.

How do I install delayedresult module in wxPython

I have installed and used wxPython on my work pc (using threading in many apps). However, I attempted to set-up the same environment on my personal computer, and I cannot get the module lib.delayed result to run for anything. I can use wxPython with my applications that don't use threading, but when I attempt to run any app that uses threading, I get the following traceback:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import lib.delayedresult
ImportError: No module named lib.delayedresult
I've exhausted what I know to do, at this point .... I appreciate any help/direction in advance.
I am using it by importing like:
import wx.lib.delayedresult as delayedresult

Resources