PHPthumb not working - does not show image - imagemagick

I'm trying to use phpThumb to resize the images on my website, but it doesn't work. When using the following link, with the DEBUG MODE it gives the following result.
Of all this what catches my attention is:
ApacheLookupURIarray () - FAILED
Y
ImageMagick failed with message (sh: 1:: Permission denied) in file "phpthumb.class.php" on line 2319
IP.com/phpThumb.php?src=img-noticias%2FPORTADASUGERENCIA82.jpg&zc=C&w=239&h=207&hash=a743a31b78ef3454998737fe53afdab1
Result:
phpThumb() v1.7.15-201902101903
http://phpthumb.sourceforge.net
phpThumb() version = 1.7.15-201902101903
phpversion() = 7.2.19-0ubuntu0.19.04.2
PHP_OS = Linux
$_SERVER[SERVER_SOFTWARE] = Apache/2.4.38 (Ubuntu)
__FILE__ = /var/www/html/aten/aten-ndt/phpthumb.class.php
realpath(.) = /var/www/html/aten/aten-ndt
$_SERVER[PHP_SELF] = /phpThumb.php
$_SERVER[HOST_NAME] =
$_SERVER[HTTP_REFERER] =
$_SERVER[QUERY_STRING] = src=img-noticias/1.jpg&zc=C&w=239&h=207&hash=45a772ad4fb75132fa2ca0888adccc31
$_SERVER[PATH_INFO] =
$_SERVER[DOCUMENT_ROOT] = /var/www/html/aten/aten-ndt/
getenv(DOCUMENT_ROOT) = /var/www/html/aten/aten-ndt/
get_magic_quotes_gpc() = FALSE
get_magic_quotes_runtime() = FALSE
error_reporting() = integer 32767
ini_get(error_reporting) = string(5) "32767"
ini_get(display_errors) = string(1) "1"
ini_get(allow_url_fopen) = string(1) "1"
ini_get(disable_functions) = string(384) "pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,"
get_cfg_var(disable_functions) = string(384) "pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,"
ini_get(safe_mode) = FALSE
ini_get(open_basedir) = string(0) ""
ini_get(max_execution_time) = string(2) "60"
ini_get(memory_limit) = string(4) "128M"
get_cfg_var(memory_limit) = string(4) "128M"
memory_get_usage() = integer 512560
$this->config_prefer_imagemagick = TRUE
$this->config_imagemagick_path = NULL
$this->ImageMagickWhichConvert() = /usr/bin/convert
[actual ImageMagick path used] = string(16) "/usr/bin/convert"
file_exists([actual ImageMagick path used]) = TRUE
ImageMagickVersion(false) =
ImageMagickVersion(true) =
$this->config_cache_directory = string(34) "/var/www/html/aten/aten-ndt/cache/"
$this->config_cache_directory_depth = integer 2
$this->config_cache_disable_warning = FALSE
$this->config_cache_maxage = integer 2592000
$this->config_cache_maxsize = integer 10485760
$this->config_cache_maxfiles = integer 200
$this->config_cache_force_passthru = TRUE
$this->cache_filename = string(159) "/var/www/html/aten/aten-ndt/cache//6/63/phpThumb_cache_34.95.213.63__src63efe98491f28588805bb6a266c6c69c_pard302a481f61bc56f3b845af640c540ea_dat1571858082.jpeg"
is_readable($this->config_cache_directory) = TRUE
is_writable($this->config_cache_directory) = TRUE
is_readable($this->cache_filename) = TRUE
is_writable($this->cache_filename) = TRUE
$this->config_document_root = string(27) "/var/www/html/aten/aten-ndt"
$this->config_temp_directory = string(34) "/var/www/html/aten/aten-ndt/cache/"
$this->config_output_format = string(4) "jpeg"
$this->config_output_maxwidth = integer 0
$this->config_output_maxheight = integer 0
$this->config_error_message_image_default = string(0) ""
$this->config_error_bgcolor = string(6) "CCCCFF"
$this->config_error_textcolor = string(6) "FF0000"
$this->config_error_fontsize = integer 1
$this->config_error_die_on_error = TRUE
$this->config_error_silent_die_on_error = FALSE
$this->config_error_die_on_source_failure = TRUE
$this->config_nohotlink_enabled = TRUE
$this->config_nohotlink_valid_domains = array(1) { [0]=> string(12) "34.95.213.63" }
$this->config_nohotlink_erase_image = TRUE
$this->config_nohotlink_text_message = string(38) "Off-server thumbnailing is not allowed"
$this->config_nooffsitelink_enabled = TRUE
$this->config_nooffsitelink_valid_domains = array(1) { [0]=> string(12) "34.95.213.63" }
$this->config_nooffsitelink_require_refer = FALSE
$this->config_nooffsitelink_erase_image = FALSE
$this->config_nooffsitelink_text_message = string(29) "Image taken from 34.95.213.63"
$this->config_high_security_enabled = TRUE
$this->config_allow_src_above_docroot = TRUE
$this->config_allow_src_above_phpthumb = TRUE
$this->config_max_source_pixels = float 22369621
$this->config_use_exif_thumbnail_for_speed = FALSE
$this->config_border_hexcolor = string(6) "000000"
$this->config_background_hexcolor = string(6) "FFFFFF"
$this->config_ttf_directory = string(33) "/var/www/html/aten/aten-ndt/fonts"
$this->config_disable_pathinfo_parsing = TRUE
$this->config_disable_imagecopyresampled = FALSE
$this->phpThumbDebug = integer 9
$this->thumbnailQuality = integer 75
$this->thumbnailFormat = string(4) "jpeg"
$this->gdimg_output = resource
$this->gdimg_source = resource (closed)
$this->sourceFilename = string(46) "/var/www/html/aten/aten-ndt/img-noticias/1.jpg"
$this->source_width = integer 700
$this->source_height = integer 933
$this->thumbnailCropX = integer 0
$this->thumbnailCropY = float 163
$this->thumbnailCropW = integer 700
$this->thumbnailCropH = float 606
$this->exif_thumbnail_width = string(0) ""
$this->exif_thumbnail_height = string(0) ""
$this->exif_thumbnail_type = string(0) ""
$this->thumbnail_width = float 239
$this->thumbnail_height = float 207
$this->thumbnail_image_width = string(3) "239"
$this->thumbnail_image_height = string(3) "207"
strlen($this->rawImageData) = 0
strlen($this->exif_thumbnail_data) = 0
$this->src = string(46) "/var/www/html/aten/aten-ndt/img-noticias/1.jpg"
$this->new = NULL
$this->w = string(3) "239"
$this->h = string(3) "207"
$this->f = string(0) ""
$this->q = integer 75
$this->sx = NULL
$this->sy = NULL
$this->sw = NULL
$this->sh = NULL
$this->far = NULL
$this->bg = NULL
$this->bc = NULL
$this->file = NULL
$this->goto = NULL
$this->err = NULL
$this->xto = NULL
$this->ra = NULL
$this->ar = NULL
$this->aoe = NULL
$this->iar = NULL
$this->maxb = NULL
builtin_function_exists(exif_thumbnail) = TRUE
builtin_function_exists(gd_info) = TRUE
builtin_function_exists(image_type_to_mime_type) = TRUE
builtin_function_exists(getimagesize) = TRUE
builtin_function_exists(imagecopyresampled) = TRUE
builtin_function_exists(imagecopyresized) = TRUE
builtin_function_exists(imagecreate) = TRUE
builtin_function_exists(imagecreatefromstring) = TRUE
builtin_function_exists(imagecreatetruecolor) = TRUE
builtin_function_exists(imageistruecolor) = TRUE
builtin_function_exists(imagerotate) = TRUE
builtin_function_exists(imagetypes) = TRUE
builtin_function_exists(version_compare) = TRUE
builtin_function_exists(imagecreatefromgif) = TRUE
builtin_function_exists(imagecreatefromjpeg) = TRUE
builtin_function_exists(imagecreatefrompng) = TRUE
builtin_function_exists(imagecreatefromwbmp) = TRUE
builtin_function_exists(imagecreatefromxbm) = TRUE
builtin_function_exists(imagecreatefromxpm) = TRUE
builtin_function_exists(imagecreatefromstring) = TRUE
builtin_function_exists(imagecreatefromgd) = TRUE
builtin_function_exists(imagecreatefromgd2) = TRUE
builtin_function_exists(imagecreatefromgd2part) = TRUE
builtin_function_exists(imagejpeg) = TRUE
builtin_function_exists(imagegif) = TRUE
builtin_function_exists(imagepng) = TRUE
builtin_function_exists(imagewbmp) = TRUE
gd_info.GD Version = string(5) "2.2.5"
gd_info.FreeType Support = TRUE
gd_info.FreeType Linkage = string(13) "with freetype"
gd_info.GIF Read Support = TRUE
gd_info.GIF Create Support = TRUE
gd_info.JPEG Support = TRUE
gd_info.PNG Support = TRUE
gd_info.WBMP Support = TRUE
gd_info.XPM Support = TRUE
gd_info.XBM Support = TRUE
gd_info.WebP Support = TRUE
gd_info.BMP Support = TRUE
gd_info.JIS-mapped Japanese Font Support = FALSE
exif_info.EXIF Support = string(7) "enabled"
exif_info.EXIF Version = string(23) "7.2.19-0ubuntu0.19.04.2"
exif_info.Supported EXIF Version = string(4) "0220"
exif_info.Supported filetypes = string(10) "JPEG, TIFF"
ApacheLookupURIarray() -- FAILED
$_GET[src] = string(18) "img-noticias/1.jpg"
$_GET[zc] = string(1) "C"
$_GET[w] = string(3) "239"
$_GET[h] = string(3) "207"
$_GET[hash] = string(32) "45a772ad4fb75132fa2ca0888adccc31"
$_GET[phpThumbDebug] = integer 9
$this->debugmessages:
* phpThumb() v1.7.15-201902101903 in file "phpthumb.class.php" on line 233
* setParameter(config_document_root, string(27) "/var/www/html/aten/aten-ndt") in file "phpThumb.php" on line 156
* setParameter(config_disable_debug, FALSE) in file "phpThumb.php" on line 156
* setParameter(config_high_security_enabled, TRUE) in file "phpThumb.php" on line 156
* setParameter(config_high_security_url_separator, string(1) "&") in file "phpThumb.php" on line 156
* setParameter(config_allow_src_above_docroot, TRUE) in file "phpThumb.php" on line 156
* setParameter(config_allow_src_above_phpthumb, TRUE) in file "phpThumb.php" on line 156
* setParameter(config_auto_allow_symlinks, TRUE) in file "phpThumb.php" on line 156
* setParameter(config_additional_allowed_dirs, array(0) { } ) in file "phpThumb.php" on line 156
* setParameter(config_cache_directory, string(34) "/var/www/html/aten/aten-ndt/cache/") in file "phpThumb.php" on line 156
* setParameter(config_cache_disable_warning, FALSE) in file "phpThumb.php" on line 156
* setParameter(config_cache_directory_depth, integer 2) in file "phpThumb.php" on line 156
* setParameter(config_cache_maxage, integer 2592000) in file "phpThumb.php" on line 156
* setParameter(config_cache_maxsize, integer 10485760) in file "phpThumb.php" on line 156
* setParameter(config_cache_maxfiles, integer 200) in file "phpThumb.php" on line 156
* setParameter(config_cache_source_enabled, FALSE) in file "phpThumb.php" on line 156
* setParameter(config_cache_source_directory, string(41) "/var/www/html/aten/aten-ndt/cache/source/") in file "phpThumb.php" on line 156
* setParameter(config_cache_source_filemtime_ignore_local, FALSE) in file "phpThumb.php" on line 156
* setParameter(config_cache_source_filemtime_ignore_remote, TRUE) in file "phpThumb.php" on line 156
* setParameter(config_cache_default_only_suffix, string(0) "") in file "phpThumb.php" on line 156
* setParameter(config_cache_prefix, string(28) "phpThumb_cache_34.95.213.63_") in file "phpThumb.php" on line 156
* setParameter(config_cache_force_passthru, TRUE) in file "phpThumb.php" on line 156
* setParameter(config_temp_directory, string(34) "/var/www/html/aten/aten-ndt/cache/") in file "phpThumb.php" on line 156
* setParameter(config_prefer_imagemagick, TRUE) in file "phpThumb.php" on line 156
* setParameter(config_imagemagick_use_thumbnail, TRUE) in file "phpThumb.php" on line 156
* setParameter(config_imagemagick_path, NULL) in file "phpThumb.php" on line 156
* setParameter(config_max_source_pixels, float 22369621) in file "phpThumb.php" on line 156
* setParameter(config_output_format, string(4) "jpeg") in file "phpThumb.php" on line 156
* setParameter(config_output_maxwidth, integer 0) in file "phpThumb.php" on line 156
* setParameter(config_output_maxheight, integer 0) in file "phpThumb.php" on line 156
* setParameter(config_output_interlace, TRUE) in file "phpThumb.php" on line 156
* setParameter(config_error_image_width, integer 400) in file "phpThumb.php" on line 156
* setParameter(config_error_image_height, integer 100) in file "phpThumb.php" on line 156
* setParameter(config_error_message_image_default, string(0) "") in file "phpThumb.php" on line 156
* setParameter(config_error_bgcolor, string(6) "CCCCFF") in file "phpThumb.php" on line 156
* setParameter(config_error_textcolor, string(6) "FF0000") in file "phpThumb.php" on line 156
* setParameter(config_error_fontsize, integer 1) in file "phpThumb.php" on line 156
* setParameter(config_error_die_on_error, TRUE) in file "phpThumb.php" on line 156
* setParameter(config_error_silent_die_on_error, FALSE) in file "phpThumb.php" on line 156
* setParameter(config_error_die_on_source_failure, TRUE) in file "phpThumb.php" on line 156
* setParameter(config_nohotlink_enabled, TRUE) in file "phpThumb.php" on line 156
* setParameter(config_nohotlink_valid_domains, array(1) { [0]=> string(12) "34.95.213.63" } ) in file "phpThumb.php" on line 156
* setParameter(config_nohotlink_erase_image, TRUE) in file "phpThumb.php" on line 156
* setParameter(config_nohotlink_text_message, string(38) "Off-server thumbnailing is not allowed") in file "phpThumb.php" on line 156
* setParameter(config_nooffsitelink_enabled, TRUE) in file "phpThumb.php" on line 156
* setParameter(config_nooffsitelink_valid_domains, array(1) { [0]=> string(12) "34.95.213.63" } ) in file "phpThumb.php" on line 156
* setParameter(config_nooffsitelink_require_refer, FALSE) in file "phpThumb.php" on line 156
* setParameter(config_nooffsitelink_erase_image, FALSE) in file "phpThumb.php" on line 156
* setParameter(config_nooffsitelink_watermark_src, string(26) "/demo/images/watermark.png") in file "phpThumb.php" on line 156
* setParameter(config_nooffsitelink_text_message, string(29) "Image taken from 34.95.213.63") in file "phpThumb.php" on line 156
* setParameter(config_border_hexcolor, string(6) "000000") in file "phpThumb.php" on line 156
* setParameter(config_background_hexcolor, string(6) "FFFFFF") in file "phpThumb.php" on line 156
* setParameter(config_ttf_directory, string(33) "/var/www/html/aten/aten-ndt/fonts") in file "phpThumb.php" on line 156
* setParameter(config_http_user_agent, string(114) "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36") in file "phpThumb.php" on line 156
* setParameter(config_disable_pathinfo_parsing, TRUE) in file "phpThumb.php" on line 156
* setParameter(config_disable_imagecopyresampled, FALSE) in file "phpThumb.php" on line 156
* setParameter(config_disable_onlycreateable_passthru, TRUE) in file "phpThumb.php" on line 156
* setParameter(config_disable_realpath, FALSE) in file "phpThumb.php" on line 156
* setParameter(config_http_fopen_timeout, integer 10) in file "phpThumb.php" on line 156
* setParameter(config_http_follow_redirect, TRUE) in file "phpThumb.php" on line 156
* setParameter(config_allow_local_http_src, FALSE) in file "phpThumb.php" on line 156
* setParameter(config_use_exif_thumbnail_for_speed, FALSE) in file "phpThumb.php" on line 156
* phpThumb() v1.7.15-201902101903
http://phpthumb.sourceforge.net
ERROR: invalid hash in file "phpthumb.class.php" on line 4197
* setParameter(src, string(18) "img-noticias/1.jpg") in file "phpThumb.php" on line 389
* resolvePath: /var/www/html/aten/aten-ndt/img-noticias/1.jpg (allowed_dirs: Array
(
)
) in file "phpthumb.class.php" on line 1180
* resolvePath: checks disabled, returning /var/www/html/aten/aten-ndt/img-noticias/1.jpg in file "phpthumb.class.php" on line 1190
* setSourceFilename(/var/www/html/aten/aten-ndt/img-noticias/1.jpg) set $this->sourceFilename to "/var/www/html/aten/aten-ndt/img-noticias/1.jpg" in file "phpthumb.class.php" on line 298
* setParameter(zc, string(1) "C") in file "phpThumb.php" on line 389
* setParameter(w, string(3) "239") in file "phpThumb.php" on line 389
* setParameter(h, string(3) "207") in file "phpThumb.php" on line 389
* setParameter(hash, string(32) "45a772ad4fb75132fa2ca0888adccc31") in file "phpThumb.php" on line 389
* setParameter(phpThumbDebug, integer 9) in file "phpThumb.php" on line 389
* $CanPassThroughDirectly=false because $_GET[zc;hash] are set in file "phpThumb.php" on line 472
* $CanPassThroughDirectly="0" && $phpThumb->src="/var/www/html/aten/aten-ndt/img-noticias/1.jpg" in file "phpThumb.php" on line 483
* $AvailableImageOutputFormats = array(text;ico;bmp;wbmp;gif;webp;png;jpeg) in file "phpthumb.class.php" on line 1009
* $this->thumbnailFormat set to $this->config_output_format "jpeg" in file "phpthumb.class.php" on line 1020
* $this->thumbnailQuality set to "75" in file "phpthumb.class.php" on line 1037
* SetCacheFilename() _src set from md5($this->sourceFilename) "/var/www/html/aten/aten-ndt/img-noticias/1.jpg" = "63efe98491f28588805bb6a266c6c69c" in file "phpthumb.class.php" on line 3591
* SetCacheFilename() _par set from md5(_zcC_h207_w239_dpi150_q75) in file "phpthumb.class.php" on line 3624
* Would have used cached file, but skipping due to phpThumbDebug in file "phpThumb.php" on line 66
* * Would have sent headers (1): Last-Modified: Wed, 23 Oct 2019 21:24:38 GMT in file "phpThumb.php" on line 67
* * Would have sent headers (2): Content-Type: image/jpeg in file "phpThumb.php" on line 69
* * Would have sent headers (3): Location: /cache//6/63/phpThumb_cache_34.95.213.63__src63efe98491f28588805bb6a266c6c69c_pard302a481f61bc56f3b845af640c540ea_dat1571858082.jpeg in file "phpThumb.php" on line 72
* resolvePath: /var/www/html/aten/aten-ndt/img-noticias/1.jpg (allowed_dirs: Array
(
)
) in file "phpthumb.class.php" on line 1180
* resolvePath: checks disabled, returning /var/www/html/aten/aten-ndt/img-noticias/1.jpg in file "phpthumb.class.php" on line 1190
* $this->sourceFilename set to "/var/www/html/aten/aten-ndt/img-noticias/1.jpg" in file "phpthumb.class.php" on line 930
* $this->cache_filename already set, skipping SetCacheFilename() in file "phpthumb.class.php" on line 3547
* starting ExtractEXIFgetImageSize() in file "phpthumb.class.php" on line 3389
* getimagesize(/var/www/html/aten/aten-ndt/img-noticias/1.jpg) says image is 700x933 in file "phpthumb.class.php" on line 3399
* $this->useRawIMoutput=true after checking $UnAllowedParameters in file "phpthumb.class.php" on line 1635
* phpThumb_tempnam() returning "/var/www/html/aten/aten-ndt/cache/pThumb1aQo7r" in file "phpthumb.class.php" on line 4426
* ImageMagickSwitchAvailable(thumbnail) = 0 in file "phpthumb.class.php" on line 1571
* IMuseExplicitImageOutputDimensions = 0 in file "phpthumb.class.php" on line 1716
* getimagesize(/var/www/html/aten/aten-ndt/img-noticias/1.jpg) SUCCEEDED: Array
(
[0] => 700
[1] => 933
[2] => 2
[3] => width="700" height="933"
[bits] => 8
[channels] => 3
[mime] => image/jpeg
)
in file "phpthumb.class.php" on line 1730
* ImageMagickSwitchAvailable(density) = 0 in file "phpthumb.class.php" on line 1571
* getimagesize(/var/www/html/aten/aten-ndt/img-noticias/1.jpg) returned [w=700;h=933;f=2] in file "phpthumb.class.php" on line 1745
* source dimensions set to 700x933 in file "phpthumb.class.php" on line 1748
* SetOrientationDependantWidthHeight() starting with "700"x"933" in file "phpthumb.class.php" on line 3368
* SetOrientationDependantWidthHeight() setting w="239", h="207" in file "phpthumb.class.php" on line 3384
* ImageMagickSwitchAvailable(repage) = 0 in file "phpthumb.class.php" on line 1571
* Skipping "+repage" because ImageMagick (v) does not support it in file "phpthumb.class.php" on line 1832
* Remaining $this->fltr after ImageMagick: (array(0) { } ) in file "phpthumb.class.php" on line 2296
* ImageMagickSwitchAvailable(quality;interlace) = 0 in file "phpthumb.class.php" on line 1568
* ImageMagick called as ('' '/var/www/html/aten/aten-ndt/img-noticias/1.jpg[0]' -background '#FFFFFF' -flatten -resize 'x319' -gravity center -crop '239x207+0+0' jpeg:'/var/www/html/aten/aten-ndt/cache/pThumb1aQo7r' 2>&1) in file "phpthumb.class.php" on line 2314
* ImageMagick failed with message (sh: 1: : Permission denied) in file "phpthumb.class.php" on line 2319
* deleting "/var/www/html/aten/aten-ndt/cache/pThumb1aQo7r" in file "phpthumb.class.php" on line 2351
* ImageMagickThumbnailToGD() failed in file "phpthumb.class.php" on line 3435
* SetOrientationDependantWidthHeight() starting with "700"x"933" in file "phpthumb.class.php" on line 3368
* SetOrientationDependantWidthHeight() setting w="239", h="207" in file "phpthumb.class.php" on line 3384
* EXIF thumbnail extraction: (size=0; type=""; 0x0) in file "phpthumb.class.php" on line 3492
* starting SourceImageToGD() in file "phpthumb.class.php" on line 3750
* starting ImageCreateFromFilename(/var/www/html/aten/aten-ndt/img-noticias/1.jpg) in file "phpthumb.class.php" on line 3665
* ImageCreateFromFilename found ($getimagesizeinfo[2]==2) in file "phpthumb.class.php" on line 3674
* Calling imagecreatefromjpeg(/var/www/html/aten/aten-ndt/img-noticias/1.jpg) in file "phpthumb.class.php" on line 3682
* Not using EXIF thumbnail data because $this->gdimg_source is already set in file "phpthumb.class.php" on line 3818
* CalculateThumbnailDimensions() starting with [W,H,sx,sy,sw,sh] initially set to [700,933,,,,] in file "phpthumb.class.php" on line 3240
* CalculateThumbnailDimensions() starting with [x,y,w,h] initially set to [0,0,700,933] in file "phpthumb.class.php" on line 3255
* CreateGDoutput() returning canvas "239x207" in file "phpthumb.class.php" on line 3363
* ImageResizeFunction($o, $s, 0, 0, 0, 163, 239, 207, 700, 606) in file "phpthumb.class.php" on line 4401
* memory_get_usage() after copy-resize = 489360 in file "phpthumb.class.php" on line 430
* memory_get_usage() after imagedestroy = 489448 in file "phpthumb.class.php" on line 432
* AntiOffsiteLinking() says this is allowed in file "phpthumb.class.php" on line 2558
* skipping AlphaChannelFlatten() because !$this->is_alpha in file "phpthumb.class.php" on line 2614
* GenerateThumbnail() completed successfully in file "phpthumb.class.php" on line 444
* CleanUpCacheDirectory() set to purge (30.0 days; 10.00 MB; 200 files) in file "phpthumb.class.php" on line 748
* CleanUpCacheDirectory() skipped because "/var/www/html/aten/aten-ndt/cache//phpThumbCacheStats.txt" is recently modified in file "phpthumb.class.php" on line 758
* imageinterlace($this->gdimg_output, 1) in file "phpthumb.class.php" on line 480
* RenderOutput() attempting imagejpeg($this->gdimg_output) in file "phpthumb.class.php" on line 483
* RenderOutput() completing with $this->outputImageData = 8893 bytes in file "phpthumb.class.php" on line 597
* RenderToFile(/var/www/html/aten/aten-ndt/cache//6/63/phpThumb_cache_34.95.213.63__src63efe98491f28588805bb6a266c6c69c_pard302a481f61bc56f3b845af640c540ea_dat1571858082.jpeg) succeeded in file "phpthumb.class.php" on line 626
* Would have used cached file, but skipping due to phpThumbDebug in file "phpThumb.php" on line 66
* * Would have sent headers (1): Last-Modified: Wed, 23 Oct 2019 21:24:38 GMT in file "phpThumb.php" on line 67
* * Would have sent headers (2): Content-Type: image/jpeg in file "phpThumb.php" on line 69
* * Would have sent headers (3): Location: /cache//6/63/phpThumb_cache_34.95.213.63__src63efe98491f28588805bb6a266c6c69c_pard302a481f61bc56f3b845af640c540ea_dat1571858082.jpeg in file "phpThumb.php" on line 72
$this->debugtiming:
* 1571866156.693490 : phpThumb() constructor in file "phpthumb.class.php" on line 232
* 1571866156.693428 : phpThumb.php start in file "phpThumb.php" on line 123
* 1571866166.694023 : phpThumbDebug[0] in file "phpThumb.php" on line 215
* 1571866166.694079 : phpThumbDebug[1] in file "phpThumb.php" on line 272
* 1571866166.694112 : phpThumbDebug[2] in file "phpThumb.php" on line 374
* 1571866166.694238 : phpThumbDebug[3] in file "phpThumb.php" on line 410
* 1571866166.694274 : phpThumbDebug[4] in file "phpThumb.php" on line 477
* 1571866166.694283 : phpThumbDebug[5] in file "phpThumb.php" on line 564
* 1571866166.694428 : skipped using cached image in file "phpThumb.php" on line 65
* 1571866166.694512 : phpThumbDebug[6] in file "phpThumb.php" on line 580
* 1571866166.694521 : phpThumbDebug[7] in file "phpThumb.php" on line 645
* 1571866166.713554 : phpThumbDebug[8] in file "phpThumb.php" on line 655
* 1571866166.715369 : skipped using cached image in file "phpThumb.php" on line 65
* 1571866166.715426 : phpThumbDebug[9] in file "phpThumb.php" on line 688
* Total processing time: 10.021998

Related

Add random numbers to dask dataframe using data from the dataframe to set limits

I would like to add random numbers to a dask dataframe that uses a column intensity of the original dataframe to set the limits of the random numbers for each row. The code works with pandas and numpy.random, but not with dask and dask.array.
import dask.array as da
import dask.dataframe as dd
from dask.distributed import Client
client = Client()
fns = [list-of-filenames]
df = dd.read_parquet(fns)
# dataframe has a column called intensity of type float
# and no missing values
df['separation_dimension_1'] = da.random.uniform(size=N, low=-noise_level/df.intensity, high=noise_level/df.intensity)
The error is:
ValueError: shape mismatch: objects cannot be broadcast to a single shape. Mismatch is between arg 0 with shape (0,) and arg 1 with shape (33276691,).
Seems the syntax of numpy.random.uniform is a bit different than dask_array.random.uniform?
Full traceback
Cell In[21], line 7
5 df['mz_'] = df.mz * 1000000000
6 df['rt_'] = df.scan_time*10
----> 7 df['separation_dimension_1'] = da.random.uniform(size=N, low=-noise_level/df.intensity, high=noise_level/df.intensity)
8 #df['separation_dimension_2'] = da.random.uniform(size=N, low=-noise_level/df.intensity, high=noise_level/df.intensity)
9 #df['separation_dimension_3'] = da.random.uniform(size=N, low=-noise_level/df.intensity, high=noise_level/df.intensity)
11 df = df[df.intensity > 1e5][['rt_', 'mz_', 'logint']]
File ~/miniconda3/envs/dask/lib/python3.9/site-packages/dask/array/random.py:465, in _make_api.<locals>.wrapper(*args, **kwargs)
462 if backend not in _cached_random_states:
463 # Cache the default RandomState object for this backend
464 _cached_random_states[backend] = RandomState()
--> 465 return getattr(
466 _cached_random_states[backend],
467 attr,
468 )(*args, **kwargs)
File ~/miniconda3/envs/dask/lib/python3.9/site-packages/dask/array/random.py:423, in RandomState.uniform(self, low, high, size, chunks, **kwargs)
421 #derived_from(np.random.RandomState, skipblocks=1)
422 def uniform(self, low=0.0, high=1.0, size=None, chunks="auto", **kwargs):
--> 423 return self._wrap("uniform", low, high, size=size, chunks=chunks, **kwargs)
File ~/miniconda3/envs/dask/lib/python3.9/site-packages/dask/array/random.py:170, in RandomState._wrap(self, funcname, size, chunks, extra_chunks, *args, **kwargs)
165 kwrg[k] = (getitem, lookup[k], slc)
166 vals.append(
167 (_apply_random, self._RandomState, funcname, seed, size, arg, kwrg)
168 )
--> 170 meta = _apply_random(
171 self._RandomState,
172 funcname,
173 seed,
174 (0,) * len(size),
175 small_args,
176 small_kwargs,
177 )
179 dsk.update(dict(zip(keys, vals)))
181 graph = HighLevelGraph.from_collections(name, dsk, dependencies=dependencies)
File ~/miniconda3/envs/dask/lib/python3.9/site-packages/dask/array/random.py:453, in _apply_random(RandomState, funcname, state_data, size, args, kwargs)
451 state = RandomState(state_data)
452 func = getattr(state, funcname)
--> 453 return func(*args, size=size, **kwargs)
File mtrand.pyx:1134, in numpy.random.mtrand.RandomState.uniform()
File _common.pyx:600, in numpy.random._common.cont()
File _common.pyx:517, in numpy.random._common.cont_broadcast_2()
File __init__.pxd:741, in numpy.PyArray_MultiIterNew3()
ValueError: shape mismatch: objects cannot be broadcast to a single shape. Mismatch is between arg 0 with shape (0,) and arg 1 with shape (6249365,).
As is often the case, you will be able to do this using map_partitions, which applies the operation you are after on each component real pandas dataframe
def op(df):
df['separation_dimension_1'] = np.random.uniform(size=N, low=-noise_level/df.intensity, high=noise_level/df.intensity)
return df
df2 = df.map_partitions(op)

Error using BayesSearchCV from skopt on RandomForestClassifier

this is the code to reproduce the error:
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LogisticRegression
from scipy.stats import loguniform
from skopt import BayesSearchCV
from sklearn.datasets import load_iris
import numpy as np
X, y = load_iris(return_X_y=True)
grid = {
'LogisticRegression' : {
'C': loguniform.rvs(0.1, 10000, size = 50),
'solver': ['lbfgs','saga'],
'penalty': ['l2'],
'warm_start': [False, True],
'class_weight' : [None, 'balanced'],
'max_iter': [100, 1000],
'n_jobs': [ 10 ]
},
'RandomForestClassifier' : {
'n_estimators': np.random.randint(5, 200, size=10),
'criterion' : [ 'gini', 'entropy' ],
'max_depth' : np.random.randint(5, 50, size=10),
'min_samples_split': np.random.randint(5, 50, size=10),
'min_samples_leaf': np.random.randint(5, 50, size=10),
'max_features' : loguniform.rvs(0.2, 1.0, size=5),
'n_jobs' : [ 10 ]
}
}
tuner_params = {
'cv': 2,
'n_jobs': 10,
'scoring': 'roc_auc_ovr',
'return_train_score': True,
'refit': True,
'n_iter':3
}
clf = 'LogisticRegression'
search_cv = BayesSearchCV( estimator = eval(clf)(), search_spaces = grid[clf], **tuner_params)
search_cv.fit(X,y)
clf = 'RandomForestClassifier'
search_cv = BayesSearchCV( estimator = eval(clf)(), search_spaces = grid[clf], **tuner_params)
search_cv.fit(X,y)
Using BayesSearchCV on LogisticRegression as classifier gives no error, while using RandomForestClassifier it gives the following error:
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
Input In [8], in <cell line: 2>()
1 search_cv = BayesSearchCV( estimator = eval(clf)(), search_spaces = grid[clf], **tuner_params)
----> 2 search_cv.fit(X,y)
File ~/.conda/envs/meth/lib/python3.9/site-packages/skopt/searchcv.py:466, in BayesSearchCV.fit(self, X, y, groups, callback, **fit_params)
463 else:
464 self.optimizer_kwargs_ = dict(self.optimizer_kwargs)
--> 466 super().fit(X=X, y=y, groups=groups, **fit_params)
468 # BaseSearchCV never ranked train scores,
469 # but apparently we used to ship this (back-compat)
470 if self.return_train_score:
File ~/.conda/envs/meth/lib/python3.9/site-packages/sklearn/model_selection/_search.py:875, in BaseSearchCV.fit(self, X, y, groups, **fit_params)
869 results = self._format_results(
870 all_candidate_params, n_splits, all_out, all_more_results
871 )
873 return results
--> 875 self._run_search(evaluate_candidates)
877 # multimetric is determined here because in the case of a callable
878 # self.scoring the return type is only known after calling
879 first_test_score = all_out[0]["test_scores"]
File ~/.conda/envs/meth/lib/python3.9/site-packages/skopt/searchcv.py:512, in BayesSearchCV._run_search(self, evaluate_candidates)
508 while n_iter > 0:
509 # when n_iter < n_points points left for evaluation
510 n_points_adjusted = min(n_iter, n_points)
--> 512 optim_result = self._step(
513 search_space, optimizer,
514 evaluate_candidates, n_points=n_points_adjusted
515 )
516 n_iter -= n_points
518 if eval_callbacks(callbacks, optim_result):
File ~/.conda/envs/meth/lib/python3.9/site-packages/skopt/searchcv.py:400, in BayesSearchCV._step(self, search_space, optimizer, evaluate_candidates, n_points)
397 """Generate n_jobs parameters and evaluate them in parallel.
398 """
399 # get parameter values to evaluate
--> 400 params = optimizer.ask(n_points=n_points)
402 # convert parameters to python native types
403 params = [[np.array(v).item() for v in p] for p in params]
File ~/.conda/envs/meth/lib/python3.9/site-packages/skopt/optimizer/optimizer.py:395, in Optimizer.ask(self, n_points, strategy)
393 X = []
394 for i in range(n_points):
--> 395 x = opt.ask()
396 X.append(x)
398 ti_available = "ps" in self.acq_func and len(opt.yi) > 0
File ~/.conda/envs/meth/lib/python3.9/site-packages/skopt/optimizer/optimizer.py:367, in Optimizer.ask(self, n_points, strategy)
336 """Query point or multiple points at which objective should be evaluated.
337
338 n_points : int or None, default: None
(...)
364
365 """
366 if n_points is None:
--> 367 return self._ask()
369 supported_strategies = ["cl_min", "cl_mean", "cl_max"]
371 if not (isinstance(n_points, int) and n_points > 0):
File ~/.conda/envs/meth/lib/python3.9/site-packages/skopt/optimizer/optimizer.py:434, in Optimizer._ask(self)
430 if self._n_initial_points > 0 or self.base_estimator_ is None:
431 # this will not make a copy of `self.rng` and hence keep advancing
432 # our random state.
433 if self._initial_samples is None:
--> 434 return self.space.rvs(random_state=self.rng)[0]
435 else:
436 # The samples are evaluated starting form initial_samples[0]
437 return self._initial_samples[
438 len(self._initial_samples) - self._n_initial_points]
File ~/.conda/envs/meth/lib/python3.9/site-packages/skopt/space/space.py:900, in Space.rvs(self, n_samples, random_state)
897 columns = []
899 for dim in self.dimensions:
--> 900 columns.append(dim.rvs(n_samples=n_samples, random_state=rng))
902 # Transpose
903 return _transpose_list_array(columns)
File ~/.conda/envs/meth/lib/python3.9/site-packages/skopt/space/space.py:698, in Categorical.rvs(self, n_samples, random_state)
696 return self.inverse_transform([(choices)])
697 elif self.transform_ == "normalize":
--> 698 return self.inverse_transform(list(choices))
699 else:
700 return [self.categories[c] for c in choices]
File ~/.conda/envs/meth/lib/python3.9/site-packages/skopt/space/space.py:685, in Categorical.inverse_transform(self, Xt)
680 """Inverse transform samples from the warped space back into the
681 original space.
682 """
683 # The concatenation of all transformed dimensions makes Xt to be
684 # of type float, hence the required cast back to int.
--> 685 inv_transform = super(Categorical, self).inverse_transform(Xt)
686 if isinstance(inv_transform, list):
687 inv_transform = np.array(inv_transform)
File ~/.conda/envs/meth/lib/python3.9/site-packages/skopt/space/space.py:168, in Dimension.inverse_transform(self, Xt)
164 def inverse_transform(self, Xt):
165 """Inverse transform samples from the warped space back into the
166 original space.
167 """
--> 168 return self.transformer.inverse_transform(Xt)
File ~/.conda/envs/meth/lib/python3.9/site-packages/skopt/space/transformers.py:309, in Pipeline.inverse_transform(self, X)
307 def inverse_transform(self, X):
308 for transformer in self.transformers[::-1]:
--> 309 X = transformer.inverse_transform(X)
310 return X
File ~/.conda/envs/meth/lib/python3.9/site-packages/skopt/space/transformers.py:216, in LabelEncoder.inverse_transform(self, Xt)
214 else:
215 Xt = np.asarray(Xt)
--> 216 return [
217 self.inverse_mapping_[int(np.round(i))] for i in Xt
218 ]
File ~/.conda/envs/meth/lib/python3.9/site-packages/skopt/space/transformers.py:217, in <listcomp>(.0)
214 else:
215 Xt = np.asarray(Xt)
216 return [
--> 217 self.inverse_mapping_[int(np.round(i))] for i in Xt
218 ]
KeyError: 9
My versions:
python: 3.9.12
sklearn: 1.1.1
skopt: 0.9.0
The same error happen when using XGBClassifier or GradientBoostingClassifier, while there is no error using SVC or KNeighborsClassifier.
I believe that's related to how skopt encodes the hyperparameter space: it seems having identical points generated by your random lists are required to trigger the error, though sometimes it fits regardless. Either there are collisions or it makes the grid to be processed erroneously.
At least the issue stopped reproducing for me after changing all random lists to list(range(...)).
Might be worth a bug report.

Problem with evaluation function in tensorflow federated

I was trying to reimplement the github tutorial with my own CNN-based model with Keras. But I got an error when evaluating.
from __future__ import absolute_import, division, print_function
import collections
from six.moves import range
import numpy as np
import tensorflow as tf
from tensorflow.python.keras.optimizer_v2 import gradient_descent
from tensorflow_federated import python as tff
emnist_train, emnist_test = tff.simulation.datasets.emnist.load_data()
example_dataset = emnist_train.create_tf_dataset_for_client(
emnist_train.client_ids[0])
NUM_EPOCHS = 10
BATCH_SIZE = 20
SHUFFLE_BUFFER = 500
def preprocess(dataset):
def element_fn(element):
return collections.OrderedDict([
('x', tf.reshape(element['pixels'], [-1])),
('y', tf.reshape(element['label'], [1])),
])
return dataset.repeat(NUM_EPOCHS).map(element_fn).shuffle(
SHUFFLE_BUFFER).batch(BATCH_SIZE)
preprocessed_example_dataset = preprocess(example_dataset)
sample_batch = nest.map_structure(
lambda x: x.numpy(), iter(preprocessed_example_dataset).next())
def make_federated_data(client_data, client_ids):
return [preprocess(client_data.create_tf_dataset_for_client(x))
for x in client_ids]
NUM_CLIENTS = 3
sample_clients = emnist_train.client_ids[0:NUM_CLIENTS]
federated_train_data = make_federated_data(emnist_train, sample_clients)
len(federated_train_data), federated_train_data[0]
def create_compiled_keras_model():
model = tf.keras.models.Sequential([
tf.keras.layers.Reshape((28,28,1), input_shape=(784,)),
tf.keras.layers.Conv2D(32, kernel_size=(5,5), activation="relu", padding = "same", strides = 1),
tf.keras.layers.MaxPooling2D(pool_size=2, strides=2, padding='valid'),
tf.keras.layers.Conv2D(64, kernel_size=(5,5), activation="relu", padding = "same", strides = 1),
tf.keras.layers.MaxPooling2D(pool_size=2, strides=2, padding='valid'),
tf.keras.layers.Flatten(),
tf.keras.layers.Dense(512, activation="relu"),
tf.keras.layers.Dense(10, activation="softmax"),
])
def loss_fn(y_true, y_pred):
return tf.reduce_mean(tf.keras.losses.sparse_categorical_crossentropy(
y_true, y_pred))
model.compile(
loss=loss_fn,
optimizer=gradient_descent.SGD(learning_rate=0.02),
metrics=[tf.keras.metrics.SparseCategoricalAccuracy()])
return model
def model_fn():
keras_model = create_compiled_keras_model()
return tff.learning.from_compiled_keras_model(keras_model, sample_batch)
iterative_process = tff.learning.build_federated_averaging_process(model_fn)
state = iterative_process.initialize()
for round_num in range(1,10):
state, metrics = iterative_process.next(state, federated_train_data)
print('round {:2d}, metrics={}'.format(round_num, metrics))
##Evaluation of the model
#This function doesn't work
evaluation = tff.learning.build_federated_evaluation(model_fn)
federated_test_data = make_federated_data(emnist_test, sample_clients)
test_metrics = evaluation(state.model, federated_test_data)
I expect the evaluation of the test data, but the actual output is the following error:
---------------------------------------------------------------------------
_FallbackException Traceback (most recent call last)
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/ops/gen_functional_ops.py in stateful_partitioned_call(args, Tout, f, config, config_proto, executor_type, name)
482 "Tout", Tout, "f", f, "config", config, "config_proto", config_proto,
--> 483 "executor_type", executor_type)
484 return _result
_FallbackException: This function does not handle the case of the path where all inputs are not already EagerTensors.
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last)
<ipython-input-23-6e9c77f70201> in <module>()
----> 1 evaluation = tff.learning.build_federated_evaluation(model_fn)
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow_federated/python/learning/federated_evaluation.py in build_federated_evaluation(model_fn)
83 #tff.federated_computation(
84 tff.FederatedType(model_weights_type, tff.SERVER, all_equal=True),
---> 85 tff.FederatedType(tff.SequenceType(batch_type), tff.CLIENTS))
86 def server_eval(server_model_weights, federated_dataset):
87 client_outputs = tff.federated_map(
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow_federated/python/core/impl/computation_wrapper.py in <lambda>(fn)
406 args = (args,)
407 arg_type = computation_types.to_type(args[0])
--> 408 return lambda fn: _wrap(fn, arg_type, self._wrapper_fn)
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow_federated/python/core/impl/computation_wrapper.py in _wrap(fn, parameter_type, wrapper_fn)
94 function_utils.wrap_as_zero_or_one_arg_callable(fn, parameter_type),
95 parameter_type,
---> 96 name=fn_name)
97 py_typecheck.check_type(concrete_fn, function_utils.ConcreteFunction,
98 'value returned by the wrapper')
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow_federated/python/core/impl/computation_wrapper_instances.py in _federated_computation_wrapper_fn(target_fn, parameter_type, name)
52 parameter_type,
53 ctx_stack,
---> 54 suggested_name=name))
55 return computation_impl.ComputationImpl(target_lambda.proto, ctx_stack)
56
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow_federated/python/core/impl/federated_computation_utils.py in zero_or_one_arg_fn_to_building_block(fn, parameter_name, parameter_type, context_stack, suggested_name)
73 value_impl.ValueImpl(
74 computation_building_blocks.Reference(
---> 75 parameter_name, parameter_type), context_stack))
76 else:
77 result = fn()
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow_federated/python/core/impl/function_utils.py in <lambda>(arg)
551 # and to force any parameter bindings to be resolved now.
552 # pylint: disable=unnecessary-lambda,undefined-variable
--> 553 return (lambda fn, at, kt: lambda arg: _unpack_and_call(fn, at, kt, arg))(
554 fn, arg_types, kwarg_types)
555 # pylint: enable=unnecessary-lambda,undefined-variable
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow_federated/python/core/impl/function_utils.py in _unpack_and_call(fn, arg_types, kwarg_types, arg)
545 name, str(expected_type), str(actual_type)))
546 kwargs[name] = element_value
--> 547 return fn(*args, **kwargs)
548
549 # Deliberate wrapping to isolate the caller from the underlying function
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow_federated/python/learning/federated_evaluation.py in server_eval(server_model_weights, federated_dataset)
88 client_eval,
89 [tff.federated_broadcast(server_model_weights), federated_dataset])
---> 90 return model.federated_output_computation(client_outputs.local_outputs)
91
92 return server_eval
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow_federated/python/learning/model_utils.py in federated_output_computation(self)
531 #property
532 def federated_output_computation(self):
--> 533 return self._model.federated_output_computation
534
535
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow_federated/python/learning/model_utils.py in federated_output_computation(self)
406 def federated_output_computation(self):
407 metric_variable_type_dict = nest.map_structure(tf.TensorSpec.from_tensor,
--> 408 self.report_local_outputs())
409 federated_local_outputs_type = tff.FederatedType(
410 metric_variable_type_dict, tff.CLIENTS, all_equal=False)
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/eager/def_function.py in __call__(self, *args, **kwds)
314 if not self._created_variables:
315 # If we did not create any variables the trace we have is good enough.
--> 316 return self._concrete_stateful_fn._filtered_call(canon_args, canon_kwds) # pylint: disable=protected-access
317
318 def fn_with_cond(*inner_args, **inner_kwds):
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/eager/function.py in _filtered_call(self, args, kwargs)
382 """
383 return self._call_flat(
--> 384 (t for t in nest.flatten((args, kwargs))
385 if isinstance(
386 t, (ops.Tensor, resource_variable_ops.ResourceVariable))))
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/eager/function.py in _call_flat(self, args)
431 # Only need to override the gradient in graph mode and when we have outputs.
432 if context.executing_eagerly() or not self.outputs:
--> 433 outputs = self._inference_function.call(ctx, args)
434 else:
435 if not self._gradient_name:
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/eager/function.py in call(self, ctx, args)
267 executing_eagerly=executing_eagerly,
268 config=function_call_options.config_proto_serialized,
--> 269 executor_type=function_call_options.executor_type)
270
271 if executing_eagerly:
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/ops/functional_ops.py in partitioned_call(args, f, tout, executing_eagerly, config, executor_type)
1081 outputs = gen_functional_ops.stateful_partitioned_call(
1082 args=args, Tout=tout, f=f, config_proto=config,
-> 1083 executor_type=executor_type)
1084 else:
1085 outputs = gen_functional_ops.partitioned_call(
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/ops/gen_functional_ops.py in stateful_partitioned_call(args, Tout, f, config, config_proto, executor_type, name)
487 return stateful_partitioned_call_eager_fallback(
488 args, Tout=Tout, f=f, config=config, config_proto=config_proto,
--> 489 executor_type=executor_type, name=name, ctx=_ctx)
490 except _core._SymbolicException:
491 pass # Add nodes to the TensorFlow graph.
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/ops/gen_functional_ops.py in stateful_partitioned_call_eager_fallback(args, Tout, f, config, config_proto, executor_type, name, ctx)
548 executor_type = ""
549 executor_type = _execute.make_str(executor_type, "executor_type")
--> 550 _attr_Tin, args = _execute.convert_to_mixed_eager_tensors(args, _ctx)
551 _inputs_flat = list(args)
552 _attrs = ("Tin", _attr_Tin, "Tout", Tout, "f", f, "config", config,
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/eager/execute.py in convert_to_mixed_eager_tensors(values, ctx)
207 def convert_to_mixed_eager_tensors(values, ctx):
208 v = [ops.internal_convert_to_tensor(t, ctx=ctx) for t in values]
--> 209 types = [t._datatype_enum() for t in v] # pylint: disable=protected-access
210 return types, v
211
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/eager/execute.py in <listcomp>(.0)
207 def convert_to_mixed_eager_tensors(values, ctx):
208 v = [ops.internal_convert_to_tensor(t, ctx=ctx) for t in values]
--> 209 types = [t._datatype_enum() for t in v] # pylint: disable=protected-access
210 return types, v
211
AttributeError: 'Tensor' object has no attribute '_datatype_enum'
Nuria: this should just have been fixed earlier today. If you do not want to wait for the next release (coming soon), I would recommend that you simply build a local pip package from source. You can find instructions in the install guide.
As a followup here: TFF 0.4.0 has just been released, which contains this bugfix.

Dask: ValueError: Integer column has NA values

I tried to use dask and found something that appears to be a bug in dask.dataframe.read_csv.
import dask.dataframe as dd
types = {'id': 'int16', 'Semana': 'uint8', 'Agencia_ID': 'uint16', 'Canal_ID': 'uint8',
'Ruta_SAK': 'uint16' ,'Cliente_ID': 'float32', 'Producto_ID': 'float32'}
name_map = {'Semana': 'week', 'Agencia_ID': 'agency', 'Canal_ID': 'channel',
'Ruta_SAK': 'route', 'Cliente_ID': 'client', 'Producto_ID': 'prod'}
test = dd.read_csv(os.path.join(datadir, 'test.csv'), usecols=types.keys(), dtype=types)
test = test.rename(columns=name_map)
gives :
ValueError: Integer column has NA values in column 1
However, the same pandas read_csv operation completes fine and does not yield any NA:
types = {'id': 'int16', 'Semana': 'uint8', 'Agencia_ID': 'uint16', 'Canal_ID': 'uint8',
'Ruta_SAK': 'uint16' ,'Cliente_ID': 'float32', 'Producto_ID': 'float32'}
name_map = {'Semana': 'week', 'Agencia_ID': 'agency', 'Canal_ID': 'channel',
'Ruta_SAK': 'route', 'Cliente_ID': 'client', 'Producto_ID': 'prod'}
test = pd.read_csv(os.path.join(datadir, 'test.csv'), usecols=types.keys(), dtype=types)
test = test.rename(columns=name_map)
test.isnull().any()
id False
week False
agency False
channel False
route False
client False
prod False
dtype: bool
Should I consider this to be an established bug and raise a JIRA for it?
Full traceback:
ValueError Traceback (most recent call last)
in ()
4 'Ruta_SAK': 'route', 'Cliente_ID': 'client', 'Producto_ID': 'prod'}
5
----> 6 test = dd.read_csv(os.path.join(datadir, 'test.csv'), usecols=types.keys(), dtype=types)
7 test = test.rename(columns=name_map)
D:\PROGLANG\Anaconda2\lib\site-packages\dask\dataframe\csv.pyc in read_csv(filename, blocksize, chunkbytes, collection, lineterminator, compression, sample, enforce, storage_options, **kwargs)
195 else:
196 header = sample.split(b_lineterminator)[0] + b_lineterminator
--> 197 head = pd.read_csv(BytesIO(sample), **kwargs)
198
199 df = read_csv_from_bytes(values, header, head, kwargs,
D:\PROGLANG\Anaconda2\lib\site-packages\pandas\io\parsers.pyc in parser_f(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, squeeze, prefix, mangle_dupe_cols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, skipfooter, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, dayfirst, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, escapechar, comment, encoding, dialect, tupleize_cols, error_bad_lines, warn_bad_lines, skip_footer, doublequote, delim_whitespace, as_recarray, compact_ints, use_unsigned, low_memory, buffer_lines, memory_map, float_precision)
560 skip_blank_lines=skip_blank_lines)
561
--> 562 return _read(filepath_or_buffer, kwds)
563
564 parser_f.name = name
D:\PROGLANG\Anaconda2\lib\site-packages\pandas\io\parsers.pyc in _read(filepath_or_buffer, kwds)
323 return parser
324
--> 325 return parser.read()
326
327 _parser_defaults = {
D:\PROGLANG\Anaconda2\lib\site-packages\pandas\io\parsers.pyc in read(self, nrows)
813 raise ValueError('skip_footer not supported for iteration')
814
--> 815 ret = self._engine.read(nrows)
816
817 if self.options.get('as_recarray'):
D:\PROGLANG\Anaconda2\lib\site-packages\pandas\io\parsers.pyc in read(self, nrows)
1312 def read(self, nrows=None):
1313 try:
-> 1314 data = self._reader.read(nrows)
1315 except StopIteration:
1316 if self._first_chunk:
pandas\parser.pyx in pandas.parser.TextReader.read (pandas\parser.c:8748)()
pandas\parser.pyx in pandas.parser.TextReader._read_low_memory (pandas\parser.c:9003)()
pandas\parser.pyx in pandas.parser.TextReader._read_rows (pandas\parser.c:10022)()
pandas\parser.pyx in pandas.parser.TextReader._convert_column_data (pandas\parser.c:11397)()
pandas\parser.pyx in pandas.parser.TextReader._convert_tokens (pandas\parser.c:12093)()
pandas\parser.pyx in pandas.parser.TextReader._convert_with_dtype (pandas\parser.c:13057)()
ValueError: Integer column has NA values in column 1

neo4django with Neo4j 2.0

I'm just starting out using Neo4j and I'd like to use 2.0 (I have 2.0.1 community installed). I see that neo4django was only tested against neo4j 1.8.2-1.9.4, but have people gotten it working with 2.x? I installed the gremlin plugin but can't create or query through neo4django.
create:
In [8]: NeoProfile.objects.create(profile_id=1234)
[INFO] requests.packages.urllib3.connectionpool#214: Resetting dropped connection: localhost
---------------------------------------------------------------------------
StatusException Traceback (most recent call last)
/Users/atomos/workspace/Project-Vitamin/lib/python2.7/site-packages/django/core/management/commands/shell.pyc in <module>()
----> 1 NeoProfile.objects.create(profile_id=1234)
/Users/atomos/workspace/Project-Vitamin/src/neo4django/neo4django/db/models/manager.pyc in create(self, **kwargs)
41
42 def create(self, **kwargs):
---> 43 return self.get_query_set().create(**kwargs)
44
45 def filter(self, *args, **kwargs):
/Users/atomos/workspace/Project-Vitamin/src/neo4django/neo4django/db/models/query.pyc in create(self, **kwargs)
1295 if 'id' in kwargs or 'pk' in kwargs:
1296 raise FieldError("Neo4j doesn't allow node ids to be assigned.")
-> 1297 return super(NodeQuerySet, self).create(**kwargs)
1298
1299 #TODO would be awesome if this were transactional
/Users/atomos/workspace/Project-Vitamin/lib/python2.7/site-packages/django/db/models/query.pyc in create(self, **kwargs)
375 obj = self.model(**kwargs)
376 self._for_write = True
--> 377 obj.save(force_insert=True, using=self.db)
378 return obj
379
/Users/atomos/workspace/Project-Vitamin/src/neo4django/neo4django/db/models/base.pyc in save(self, using, **kwargs)
315
316 def save(self, using=DEFAULT_DB_ALIAS, **kwargs):
--> 317 return super(NodeModel, self).save(using=using, **kwargs)
318
319 #alters_data
/Users/atomos/workspace/Project-Vitamin/lib/python2.7/site-packages/django/db/models/base.pyc in save(self, force_insert, force_update, using)
461 if force_insert and force_update:
462 raise ValueError("Cannot force both insert and updating in model saving.")
--> 463 self.save_base(using=using, force_insert=force_insert, force_update=force_update)
464
465 save.alters_data = True
/Users/atomos/workspace/Project-Vitamin/src/neo4django/neo4django/db/models/base.pyc in save_base(self, raw, cls, origin, force_insert, force_update, using, *args, **kwargs)
331
332 is_new = self.id is None
--> 333 self._save_neo4j_node(using)
334 self._save_properties(self, self.__node, is_new)
335 self._save_neo4j_relationships(self, self.__node)
/Users/atomos/workspace/Project-Vitamin/src/neo4django/neo4django/db/models/base.pyc in _save_neo4j_node(self, using)
/Users/atomos/workspace/Project-Vitamin/src/neo4django/neo4django/db/models/base.pyc in trans_method(func, *args, **kw)
95 #TODO this is where generalized transaction support will go,
96 #when it's ready in neo4jrestclient
---> 97 ret = func(*args, **kw)
98 #tx.commit()
99 return ret
/Users/atomos/workspace/Project-Vitamin/src/neo4django/neo4django/db/models/base.pyc in _save_neo4j_node(self, using)
359 self.__node = conn.gremlin_tx(script, types=type_hier_props,
360 indexName=self.index_name(),
--> 361 typesToIndex=type_names_to_index)
362 return self.__node
363
/Users/atomos/workspace/Project-Vitamin/src/neo4django/neo4django/neo4jclient.pyc in gremlin_tx(self, script, **params)
177 will be wrapped in a transaction.
178 """
--> 179 return self.gremlin(script, tx=True, **params)
180
181 def cypher(self, query, **params):
/Users/atomos/workspace/Project-Vitamin/src/neo4django/neo4django/neo4jclient.pyc in gremlin(self, script, tx, raw, **params)
166 try:
167 return send_script(include_unloaded_libraries(lib_script),
--> 168 params)
169 except LibraryCouldNotLoad:
170 if i == 0:
/Users/atomos/workspace/Project-Vitamin/src/neo4django/neo4django/neo4jclient.pyc in send_script(s, params)
151 if raw:
152 execute_kwargs['returns'] = RETURNS_RAW
--> 153 script_rv = ext.execute_script(s, params=params, **execute_kwargs)
154 if isinstance(script_rv, basestring):
155 if LIBRARY_ERROR_REGEX.match(script_rv):
/Users/atomos/workspace/Project-Vitamin/src/neo4j-rest-client/neo4jrestclient/client.py in __call__(self, *args, **kwargs)
2313 except (ValueError, AttributeError, KeyError, TypeError):
2314 pass
-> 2315 raise StatusException(response.status_code, msg)
2316
2317 def __repr__(self):
StatusException: Code [400]: Bad Request. Bad request syntax or unsupported method.
Invalid data sent: javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: groovy.lang.MissingMethodException.setMaxBufferSize() is applicable for argument types: () values: []
query:
In [9]: NeoProfile.objects.filter(profile_id=1234)
Out[9]: ---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
/Users/atomos/workspace/Project-Vitamin/lib/python2.7/site-packages/django/core/management/commands/shell.pyc in <module>()
----> 1 NeoProfile.objects.filter(profile_id=1234)
/Users/atomos/workspace/Project-Vitamin/lib/python2.7/site-packages/IPython/core/displayhook.pyc in __call__(self, result)
236 self.start_displayhook()
237 self.write_output_prompt()
--> 238 format_dict = self.compute_format_data(result)
239 self.write_format_data(format_dict)
240 self.update_user_ns(result)
/Users/atomos/workspace/Project-Vitamin/lib/python2.7/site-packages/IPython/core/displayhook.pyc in compute_format_data(self, result)
148 MIME type representation of the object.
149 """
--> 150 return self.shell.display_formatter.format(result)
151
152 def write_format_data(self, format_dict):
/Users/atomos/workspace/Project-Vitamin/lib/python2.7/site-packages/IPython/core/formatters.pyc in format(self, obj, include, exclude)
124 continue
125 try:
--> 126 data = formatter(obj)
127 except:
128 # FIXME: log the exception
/Users/atomos/workspace/Project-Vitamin/lib/python2.7/site-packages/IPython/core/formatters.pyc in __call__(self, obj)
445 type_pprinters=self.type_printers,
446 deferred_pprinters=self.deferred_printers)
--> 447 printer.pretty(obj)
448 printer.flush()
449 return stream.getvalue()
/Users/atomos/workspace/Project-Vitamin/lib/python2.7/site-packages/IPython/lib/pretty.pyc in pretty(self, obj)
358 if callable(meth):
359 return meth(obj, self, cycle)
--> 360 return _default_pprint(obj, self, cycle)
361 finally:
362 self.end_group()
/Users/atomos/workspace/Project-Vitamin/lib/python2.7/site-packages/IPython/lib/pretty.pyc in _default_pprint(obj, p, cycle)
478 if getattr(klass, '__repr__', None) not in _baseclass_reprs:
479 # A user-provided repr.
--> 480 p.text(repr(obj))
481 return
482 p.begin_group(1, '<')
/Users/atomos/workspace/Project-Vitamin/lib/python2.7/site-packages/django/db/models/query.pyc in __repr__(self)
70
71 def __repr__(self):
---> 72 data = list(self[:REPR_OUTPUT_SIZE + 1])
73 if len(data) > REPR_OUTPUT_SIZE:
74 data[-1] = "...(remaining elements truncated)..."
/Users/atomos/workspace/Project-Vitamin/lib/python2.7/site-packages/django/db/models/query.pyc in __len__(self)
85 self._result_cache = list(self.iterator())
86 elif self._iter:
---> 87 self._result_cache.extend(self._iter)
88 if self._prefetch_related_lookups and not self._prefetch_done:
89 self._prefetch_related_objects()
/Users/atomos/workspace/Project-Vitamin/src/neo4django/neo4django/db/models/query.pyc in iterator(self)
1274 using = self.db
1275 if not self.query.can_filter():
-> 1276 for model in self.query.execute(using):
1277 yield model
1278 else:
/Users/atomos/workspace/Project-Vitamin/src/neo4django/neo4django/db/models/query.pyc in execute(self, using)
1161 conn = connections[using]
1162
-> 1163 groovy, params = self.as_groovy(using)
1164
1165 raw_result_set = conn.gremlin_tx(groovy, **params) if groovy is not None else []
/Users/atomos/workspace/Project-Vitamin/src/neo4django/neo4django/db/models/query.pyc in as_groovy(self, using)
925 # add the typeNodeId param, either for type verification or initial
926 # type tree traversal
--> 927 cypher_params['typeNodeId'] = self.model._type_node(using).id
928
929 type_restriction_expr = """
/Users/atomos/workspace/Project-Vitamin/src/neo4django/neo4django/db/models/base.pyc in _type_node(cls, using)
411 return cls.__type_node_memoized(using)
412 else:
--> 413 return cls.__type_node_classmethod(using)
414
415 #classmethod
/Users/atomos/workspace/Project-Vitamin/src/neo4django/neo4django/db/models/base.pyc in __type_node(cls, using)
394 script_rv = conn.gremlin_tx(script, types=type_hier_props)
395 except Exception, e:
--> 396 raise RuntimeError(error_message, e)
397 if not hasattr(script_rv, 'properties'):
398 raise RuntimeError(error_message + '\n\n%s' % script_rv)
RuntimeError: ('The type node for class NeoProfile could not be created in the database.', StatusException())
My model is incredibly complex:
class NeoProfile(neomodels.NodeModel):
profile_id = neomodels.IntegerProperty(indexed=True)

Resources